/* ============================================================
   house-style / shell.css  —  Creator Magic component kit
   ------------------------------------------------------------
   Built on tokens.css (link it FIRST). Generic primitives + the
   command-center shell: aura/grain ambiance, topbar, rail, detail,
   composer, modal, buttons (incl. the spark), status dots, cards.

   New apps (yt-ui, etc.) adopt the look by using these classes.
   Pre-existing apps with their own class names (e.g. tank) should
   link ONLY tokens.css and retheme in place, to avoid collisions.
   ============================================================ */

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:var(--font-ui); font-size:var(--fs-base); line-height:1.5;
  -webkit-font-smoothing:antialiased; overflow:hidden;
}
button{ font-family:inherit; cursor:pointer; }
::selection{ background:var(--accent-soft); }

/* ===================== ambiance ===================== */
.aura{
  position:fixed; inset:0; pointer-events:none; z-index:0; opacity:var(--glow);
  background:
    radial-gradient(46% 40% at 84% 4%, var(--glow-a), transparent 72%),
    radial-gradient(40% 46% at 99% 56%, var(--glow-b), transparent 70%),
    radial-gradient(38% 34% at 6% 96%, rgba(247,147,30,.06), transparent 72%);
  transition:opacity .3s ease;
}
.grain{
  position:fixed; inset:0; pointer-events:none; z-index:1; opacity:.025;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===================== scrollbars ===================== */
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-thumb{ background:#262d38; border-radius:99px; border:2px solid transparent; background-clip:padding-box; }
*::-webkit-scrollbar-thumb:hover{ background:#333c49; background-clip:padding-box; }
*::-webkit-scrollbar-track{ background:transparent; }

/* ===================== app shell ===================== */
.app{ position:relative; z-index:2; height:100vh; display:grid; grid-template-rows:var(--topbar-h) 1fr; }

/* ---------------- topbar ---------------- */
.topbar{
  display:flex; align-items:center; gap:18px; padding:0 16px;
  border-bottom:1px solid var(--border);
  background:rgba(13,16,22,.72); backdrop-filter:blur(10px);
}
.brand{ display:flex; align-items:center; gap:9px; }
.brand img{ width:21px; height:21px; filter:drop-shadow(0 0 9px rgba(255,160,60,.45)); }
.brand b{ font-weight:600; letter-spacing:-.2px; font-size:14px; }
.brand .dot-live{ width:6px;height:6px;border-radius:50%;background:var(--green);box-shadow:0 0 8px var(--green); }
.meters{ display:flex; align-items:center; gap:16px; margin-left:6px; }
.meter{ display:flex; align-items:center; gap:7px; color:var(--muted); font-size:11px; }
.meter .bar{ width:54px; height:4px; border-radius:99px; background:#222932; overflow:hidden; }
.meter .bar i{ display:block; height:100%; border-radius:99px; background:var(--accent); }
.meter .bar.warm i{ background:var(--spark-grad); }
.topbar .spacer{ flex:1; }
.acct{ display:flex; align-items:center; gap:7px; border:1px solid var(--accent-line); color:var(--accent-2); background:var(--accent-soft); padding:5px 11px; border-radius:8px; font-size:11.5px; }
.acct .av{ width:15px;height:15px;border-radius:50%;background:var(--spark-grad); }
.icon-btn{ display:grid; place-items:center; width:30px; height:30px; border:1px solid var(--border); background:var(--panel-2); border-radius:8px; color:var(--muted); }
.icon-btn:hover{ color:var(--text); border-color:#3a4250; }

/* hamburger — shows only on the mobile breakpoint (see @media at the end) */
.hamburger{ display:none; align-items:center; background:transparent; border:none;
  cursor:pointer; color:var(--text); padding:4px 8px; margin-right:4px; flex:none; }
.hamburger:hover{ color:var(--accent-2); }
.hamburger svg{ width:20px; height:20px; }
.rail-backdrop{ display:none; }

/* ---------------- body grid + rail ---------------- */
.body{ display:grid; grid-template-columns:var(--rail-w) 1fr; min-height:0; }
.rail{ border-right:1px solid var(--border); display:flex; flex-direction:column; min-height:0; background:rgba(18,22,29,.5); }
.tabs{ display:flex; gap:2px; padding:10px 12px 0; border-bottom:1px solid var(--border); }
.tab{ flex:1; text-align:center; padding:7px 0 9px; font-size:11px; letter-spacing:.5px; color:var(--faint); background:none; border:none; border-bottom:2px solid transparent; margin-bottom:-1px; text-transform:uppercase; text-decoration:none; }
.tab:hover{ color:var(--muted); }
.tab.on, .tab.active{ color:var(--text); border-bottom-color:var(--accent); }
.rail-scroll{ overflow-y:auto; padding:10px 10px 14px; min-height:0; }
.new-proj{ width:100%; text-align:left; color:var(--muted); border:1px dashed var(--border); background:none; border-radius:8px; padding:9px 11px; font-size:12px; margin-bottom:12px; }
.new-proj:hover{ color:var(--accent-2); border-color:var(--accent-line); }
.chan{ display:flex; align-items:center; gap:9px; padding:8px 10px; border-radius:8px; color:var(--muted); font-size:12.5px; position:relative; text-decoration:none; }
.chan:hover, .chan.on{ background:var(--panel-2); color:var(--text); }
.chan.on::before{ content:""; position:absolute; left:0; top:7px; bottom:7px; width:2px; border-radius:2px; background:var(--accent); }
.chan .ico{ color:var(--faint); display:grid; place-items:center; }
.chan.on .ico, .chan:hover .ico{ color:var(--accent-2); }
.chan .nm{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chan .ct{ font-size:11px; color:var(--faint); }
.chan .live{ width:6px;height:6px;border-radius:50%;background:var(--yellow);box-shadow:0 0 7px var(--yellow); }
.rail-div{ height:1px; background:var(--border-soft); margin:12px 4px; }
.rail-lbl{ font-size:10px; letter-spacing:1px; color:var(--faint); text-transform:uppercase; padding:0 6px 8px; }
.task{ display:block; width:100%; text-align:left; border:none; background:none; padding:9px 10px; border-radius:9px; position:relative; margin-bottom:1px; }
.task:hover{ background:var(--panel-2); }
.task.on{ background:linear-gradient(90deg,var(--accent-soft),transparent 80%); }
.task.on::before{ content:""; position:absolute; left:0; top:8px; bottom:8px; width:2px; border-radius:2px; background:var(--accent); }
.task .row1{ display:flex; align-items:center; gap:8px; }
.task .ttl{ font-size:12.5px; color:var(--text); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; flex:1; }
.task.on .ttl{ color:#fff; }
.task .sub{ margin-left:16px; font-size:10.5px; color:var(--faint); margin-top:2px; }
.task .sub b{ color:var(--muted); font-weight:400; }

/* ===================== rail primitives =====================
   Promoted from tank's bespoke sidebar so the rail is a kit primitive,
   not an app-local thing: a search box, the list row (single- or
   two-line, with a hover delete + count badge) and the italic "new"
   add-row. The .tabs/.tab bar above is the shared tab strip. Apps fill
   the .rail with these and the look updates from here. */

/* search box — sits at the top of the rail */
.rail-search{ display:flex; align-items:center; gap:8px; margin:10px 10px 6px; padding:0 11px;
  background:var(--panel-2); border:1px solid var(--border); border-radius:9px; }
.rail-search:focus-within{ border-color:var(--accent-line); box-shadow:0 0 0 3px var(--accent-soft); }
.rail-search .ico{ color:var(--faint); display:grid; place-items:center; flex:none; }
.rail-search:focus-within .ico{ color:var(--accent-2); }
.rail-search input{ flex:1; min-width:0; background:none; border:none; outline:none; color:var(--text);
  font-family:var(--font-ui); font-size:12.5px; padding:8px 0; }
.rail-search input::placeholder{ color:var(--faint); }

/* list row — one clickable item (project, task, chat). Optional .row-meta
   second line, .row-ct count badge, and a delete button that fades in on hover.
   Named .list-row (not .row) on purpose: apps use bare .row for flex button
   rows in modals/forms, so the kit stays clear of that. */
.list-row{ position:relative; display:block; width:100%; text-align:left; cursor:pointer; color:var(--text);
  background:none; border:1px solid transparent; border-radius:8px; padding:9px 11px; margin-bottom:3px; }
.list-row:hover{ background:var(--panel-2); }
.list-row.on, .list-row.active{ background:var(--panel-2); border-color:var(--border); }
.list-row.on::before, .list-row.active::before{ content:""; position:absolute; left:0; top:8px; bottom:8px; width:2px; border-radius:2px; background:var(--accent); }
.list-row .row-title{ display:flex; align-items:center; gap:7px; font-size:12.5px; font-weight:600;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; padding-right:20px; }
.list-row.on .row-title, .list-row.active .row-title{ color:var(--accent-2); }
.list-row .row-title .nm{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.list-row .row-ct{ margin-left:auto; font-size:10.5px; color:var(--faint); font-weight:400; }
.list-row .row-meta{ display:flex; align-items:center; gap:8px; font-size:11px; color:var(--faint); margin-top:4px; }
.list-row .row-del{ position:absolute; top:8px; right:8px; display:inline-flex; align-items:center; cursor:pointer;
  background:none; border:none; color:var(--faint); padding:2px 4px; border-radius:5px;
  opacity:0; transition:opacity .12s, color .12s, background .12s; }
.list-row:hover .row-del{ opacity:.6; }
.list-row .row-del:hover{ opacity:1; color:var(--red); background:rgba(248,81,73,.12); }
.list-row .row-del svg{ width:12px; height:12px; }

/* italic "new" add-row — an inline add field that reads as a quiet prompt.
   Sibling to the dashed .new-proj button; use whichever an app prefers. */
.add-row{ display:flex; align-items:center; gap:8px; margin-bottom:10px; padding:9px 11px;
  border:1px dashed var(--border); border-radius:8px; color:var(--muted); cursor:text; font-style:italic; }
.add-row:hover, .add-row:focus-within{ border-color:var(--accent-line); color:var(--accent-2); }
.add-row .ico{ font-style:normal; color:var(--faint); display:grid; place-items:center; flex:none; }
.add-row:focus-within .ico{ color:var(--accent-2); }
.add-row input{ flex:1; min-width:0; background:none; border:none; outline:none; color:var(--text);
  font-family:var(--font-ui); font-style:italic; font-size:12px; padding:0; }
.add-row input::placeholder{ color:var(--faint); font-style:italic; }

/* ===================== status dots ===================== */
.dot{ width:8px;height:8px;border-radius:50%; flex:none; display:inline-block; }
.dot.queued{ background:var(--grey); }
.dot.running{ background:var(--yellow); box-shadow:0 0 0 0 rgba(210,153,34,.6); animation:cm-pulse 1.6s infinite; }
.dot.awaiting,.dot.awaiting_input{ background:var(--purple); box-shadow:0 0 8px var(--purple); }
.dot.background,.dot.background_waiting{ background:var(--cyan); }
.dot.done,.dot.completed,.dot.merged{ background:var(--green); }
.dot.failed,.dot.killed,.dot.errored{ background:var(--red); }
.dot.interrupted{ background:var(--orange); }
@keyframes cm-pulse{ 0%{box-shadow:0 0 0 0 rgba(210,153,34,.5);} 70%{box-shadow:0 0 0 6px rgba(210,153,34,0);} 100%{box-shadow:0 0 0 0 rgba(210,153,34,0);} }

/* ===================== main / detail ===================== */
/* min-width:0 lets the grid track shrink below content width; overflow-x is
   locked because horizontal page pan is never intentional — anything wide
   (a dense table) must own its scrolling via .tbl-wrap or similar. */
.main{ display:grid; grid-template-rows:1fr auto; min-height:0; min-width:0; position:relative; }
.detail{ overflow-y:auto; overflow-x:hidden; min-height:0; min-width:0; padding:30px 40px 26px; }
.detail-inner{ max-width:880px; margin:0 auto; }
.d-head{ display:flex; align-items:flex-start; gap:14px; }
.d-head h1{ font-family:var(--font-ui); font-size:23px; font-weight:600; letter-spacing:-.4px; margin:0; line-height:1.2; flex:1; text-wrap:pretty; }
.d-meta{ display:flex; align-items:center; gap:8px; color:var(--muted); font-size:11.5px; margin-top:10px; flex-wrap:wrap; }
.d-meta .stat{ display:flex; align-items:center; gap:6px; }
.code-chip{ font-family:var(--font-mono); background:var(--panel-2); border:1px solid var(--border-soft); padding:2px 7px; border-radius:6px; color:var(--muted); font-size:11px; }
.metarow{ display:flex; align-items:center; gap:8px; margin-top:14px; padding-bottom:18px; border-bottom:1px solid var(--border-soft); flex-wrap:wrap; }
.metarow .lbl{ color:var(--faint); font-size:11px; }

/* pills / chips */
.pill{ display:inline-flex; align-items:center; gap:6px; font-size:11px; padding:4px 9px; border-radius:7px; border:1px solid var(--border); color:var(--muted); background:var(--panel-2); }
.pill.ok{ color:var(--green); border-color:rgba(63,185,80,.3); background:rgba(63,185,80,.08); }
.pill.warm{ color:var(--spark-1); border-color:rgba(247,147,30,.32); background:rgba(247,147,30,.08); }
.pill.acc{ color:var(--accent-2); border-color:var(--accent-line); background:var(--accent-soft); }
.pill.bad{ color:var(--red); border-color:rgba(248,81,73,.32); background:rgba(248,81,73,.08); }
.pill:hover{ color:var(--text); }

/* ===================== buttons ===================== */
.btn{ display:inline-flex; align-items:center; gap:7px; justify-content:center; border-radius:8px; padding:7px 14px; font-size:12px; font-weight:600; border:1px solid transparent; white-space:nowrap; text-decoration:none; transition:transform .08s, filter .15s, background .15s; }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--accent); color:var(--accent-ink); }
.btn-primary:hover{ filter:brightness(1.08); }
.btn-secondary{ background:var(--panel-2); color:var(--text); border-color:var(--border); }
.btn-secondary:hover{ border-color:#3a4250; background:var(--panel-3); }
.btn-ghost{ background:none; color:var(--muted); }
.btn-ghost:hover{ color:var(--text); background:var(--panel-2); }
.btn-danger{ background:none; color:var(--red); border-color:rgba(248,81,73,.4); }
.btn-danger:hover{ background:rgba(248,81,73,.12); }
.btn-spark{ background:var(--spark-grad); color:#2a1606; font-weight:600; box-shadow:0 6px 22px -8px rgba(255,160,50,.7), 0 0 0 1px rgba(255,180,70,.4) inset; }
.btn-spark:hover{ filter:brightness(1.05); box-shadow:0 8px 28px -8px rgba(255,160,50,.85),0 0 0 1px rgba(255,180,70,.5) inset; }
.btn.sm{ padding:5px 10px; font-size:11.5px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* ===================== forms + card =====================
   Standalone controls (the .field block in the modal section is the
   label-wrapped variant). Match the house panel look + accent focus. */
.card{ background:var(--panel); border:1px solid var(--border); border-radius:var(--r-lg); padding:16px 18px; }
.field-label{ display:block; font-size:11px; letter-spacing:.3px; color:var(--muted); margin:0 0 6px; }
.field-label + .field-hint{ margin-top:-2px; }
.field-hint{ font-size:11px; color:var(--faint); margin:6px 0 0; line-height:1.5; }
.input, .textarea, .select{
  width:100%; background:var(--panel-2); border:1px solid var(--border); border-radius:var(--r-md);
  color:var(--text); font-family:var(--font-ui); font-size:13px; padding:9px 12px; outline:none;
  margin-bottom:12px; transition:border-color .15s, box-shadow .15s;
}
.textarea{ resize:vertical; min-height:88px; }
.input::placeholder, .textarea::placeholder{ color:var(--faint); }
.input:focus, .textarea:focus, .select:focus{ border-color:var(--accent-line); box-shadow:0 0 0 3px var(--accent-soft); }

/* ===================== content blocks ===================== */
.block{ margin-top:24px; }
.block h2{ font-family:var(--font-ui); font-size:15px; font-weight:600; margin:0 0 14px; display:flex; align-items:center; gap:9px; letter-spacing:-.2px; }
.block h2 .bar{ width:3px; height:15px; border-radius:2px; background:var(--accent); }
.p{ color:#c2cbd6; font-size:13px; line-height:1.65; margin:0 0 12px; }
.p .em{ color:var(--text); font-weight:600; }
.muted{ color:var(--muted); }

/* code / terminal block */
.term{ background:#0a0d12; border:1px solid var(--border-soft); border-radius:10px; padding:14px 16px; font-family:var(--font-mono); font-size:12px; color:#c8d2dd; line-height:1.7; overflow-x:auto; position:relative; }
.term .pfx{ color:var(--accent-2); }
.term .ok{ color:var(--green); } .term .warn{ color:var(--yellow); } .term .com{ color:var(--faint); }

/* title candidate cards */
.cand{ display:flex; align-items:center; gap:14px; padding:13px 14px; border-radius:10px; border:1px solid var(--border-soft); background:var(--panel); margin-bottom:8px; transition:border-color .15s, background .15s; }
.cand:hover{ border-color:var(--accent-line); background:var(--panel-2); }
.cand.picked{ border-color:var(--accent-line); background:var(--accent-soft); }
.cand .rank{ font-family:var(--font-mono); color:var(--faint); font-size:12px; width:18px; flex:none; }
.cand .body{ flex:1; min-width:0; }
.cand .t{ font-size:13.5px; color:var(--text); font-weight:500; }
.cand .meta{ display:flex; align-items:center; gap:14px; margin-top:7px; }
.ctr{ display:flex; align-items:center; gap:8px; font-size:11px; color:var(--muted); font-family:var(--font-mono); }
.ctr .track{ width:80px; height:5px; border-radius:99px; background:#222932; overflow:hidden; }
.ctr .track i{ display:block; height:100%; border-radius:99px; background:var(--spark-grad); }
.tag{ font-size:10.5px; color:var(--accent-2); background:var(--accent-soft); border:1px solid var(--accent-line); padding:2px 7px; border-radius:6px; font-family:var(--font-mono); }

/* thumbnail concept cards */
.thumbs{ display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.thumb{ border:1px solid var(--border-soft); border-radius:11px; overflow:hidden; background:var(--panel); }
/* when the card is a link, it is still a card: no underline, inherit the text colour */
a.thumb{ display:block; text-decoration:none; color:inherit; }
.thumb .img{ aspect-ratio:16/9; position:relative; background:repeating-linear-gradient(135deg,#181d25 0 9px,#1c222b 9px 18px); display:grid; place-items:center; }
/* an optional real thumbnail fills the 16:9 box; absent/broken, the striped
   placeholder gradient shows through (the .img background) */
.thumb .img img{ position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.thumb .img::after{ content:""; position:absolute; inset:0; background:radial-gradient(60% 80% at 70% 20%,var(--glow-a),transparent 70%); opacity:.5; }
.thumb .img .lab{ position:relative; font-family:var(--font-mono); font-size:10.5px; color:var(--faint); letter-spacing:.5px; text-align:center; padding:0 10px; text-shadow:0 1px 3px rgba(0,0,0,.7); }
/* with a real image the caption reads as a corner chip (bottom-left), not centred
   text over the picture; without one it stays the centred placeholder label */
.thumb .img:has(img){ place-items:end start; }
.thumb .img:has(img) .lab{ margin:7px; padding:3px 7px; border-radius:7px; background:rgba(8,10,14,.72); color:var(--text); text-shadow:none; }
.thumb .cap{ padding:10px 12px; font-size:11.5px; color:var(--muted); line-height:1.5; }
.thumb .cap b{ color:var(--text); font-weight:500; }

/* generic list / trends */
.ulist{ margin:0; padding:0; list-style:none; }
.ulist li{ position:relative; padding:8px 0 8px 22px; font-size:13px; color:#c2cbd6; border-bottom:1px solid var(--border-soft); line-height:1.55; }
.ulist li:last-child{ border-bottom:none; }
.ulist li::before{ content:"›"; position:absolute; left:4px; color:var(--accent-2); font-weight:700; }
.ulist li b{ color:var(--text); font-weight:600; }
.trend{ display:flex; align-items:center; gap:12px; padding:11px 0; border-bottom:1px solid var(--border-soft); }
.trend:last-child{ border-bottom:none; }
.trend .nm{ flex:1; font-size:13px; color:var(--text); }
.trend .vol{ font-family:var(--font-mono); font-size:11px; color:var(--muted); }
.trend .delta{ font-family:var(--font-mono); font-size:11px; padding:2px 7px; border-radius:6px; }
.trend .delta.up{ color:var(--green); background:rgba(63,185,80,.1); }
.trend .delta.flat{ color:var(--muted); background:var(--panel-2); }

/* ===================== data table =====================
   Promoted from cm-community's admin tables so dense data grids are a kit
   primitive. ALWAYS put a .tbl inside a .tbl-wrap: the wrapper gives a wide
   table its own contained horizontal scroll on small screens while .detail
   stays locked, so the page never pans sideways. Mark low-priority columns
   (th AND matching td) with .hide-sm to drop them on phones. */
.tbl-wrap{ max-width:100%; overflow-x:auto; }
table.tbl{ width:100%; border-collapse:collapse; font-size:13px; }
table.tbl th, table.tbl td{ text-align:left; padding:9px 10px; border-bottom:1px solid var(--border); vertical-align:top; }
table.tbl th{ color:var(--muted); font-weight:600; font-size:11.5px; text-transform:uppercase; letter-spacing:.04em; white-space:nowrap; }
/* long unbroken values (emails, URLs, tokens, error strings) — break anywhere */
.wrap-any{ overflow-wrap:anywhere; }

/* ===================== turn / conversation log ===================== */
.turn{ margin-top:22px; border:1px solid var(--border-soft); border-radius:12px; background:rgba(13,16,22,.55); overflow:hidden; }
.turn-head{ display:flex; align-items:center; gap:10px; padding:11px 15px; border-bottom:1px solid var(--border-soft); font-family:var(--font-mono); font-size:11px; color:var(--faint); }
.turn-head .who{ color:var(--accent-2); }
.turn-body{ padding:13px 15px; }
.turn-msg{ display:flex; gap:10px; }
.turn-msg .v{ width:2px; border-radius:2px; background:var(--accent); flex:none; }
.turn-msg .txt{ color:#c8d2dd; font-size:13px; }
.turn-acts{ margin-top:11px; font-family:var(--font-mono); font-size:11.5px; color:var(--muted); line-height:1.9; }
.turn-acts .a{ display:flex; gap:8px; align-items:baseline; }
.turn-acts .a .b{ color:var(--cyan); }
.turn-acts .a .d{ width:5px;height:5px;border-radius:50%;background:var(--accent);margin-top:7px;flex:none; }

/* ===================== composer ===================== */
.compose{ border-top:1px solid var(--border); padding:14px 40px 18px; background:rgba(13,16,22,.7); backdrop-filter:blur(8px); }
.compose-inner{ max-width:880px; margin:0 auto; }
.cbox{ border:1px solid var(--border); border-radius:12px; background:var(--panel); transition:border-color .15s, box-shadow .15s; }
.cbox:focus-within{ border-color:var(--accent-line); box-shadow:0 0 0 3px var(--accent-soft); }
.cbox textarea{ width:100%; background:none; border:none; resize:none; color:var(--text); font-family:var(--font-ui); font-size:13px; padding:13px 15px 4px; line-height:1.5; outline:none; display:block; }
.cbox textarea::placeholder{ color:var(--faint); }
.cbar{ display:flex; align-items:center; gap:8px; padding:6px 10px 9px 12px; }
.cbar .lft{ display:flex; gap:6px; align-items:center; flex:1; color:var(--faint); font-size:11px; }
.cbar .chip{ display:flex; align-items:center; gap:5px; border:1px solid var(--border); background:var(--panel-2); color:var(--muted); padding:4px 9px; border-radius:7px; font-size:11px; }
.cbar .chip:hover{ color:var(--text); border-color:#3a4250; }

/* ===================== modal ===================== */
.overlay{ position:fixed; inset:0; z-index:40; display:grid; place-items:center; padding:24px; background:rgba(6,8,12,.66); backdrop-filter:blur(6px); animation:cm-fade .18s ease; }
@keyframes cm-fade{ from{opacity:0;} to{opacity:1;} }
.modal{ width:min(680px,100%); max-height:88vh; overflow-y:auto; background:var(--panel); border:1px solid var(--border); border-radius:16px; box-shadow:0 30px 90px -30px rgba(0,0,0,.8), 0 0 0 1px rgba(188,140,255,.08); position:relative; animation:cm-rise .22s cubic-bezier(.2,.8,.25,1); }
.modal::before{ content:""; position:absolute; inset:0; border-radius:16px; pointer-events:none; background:radial-gradient(70% 50% at 80% -10%,var(--glow-a),transparent 70%); opacity:.7; }
@keyframes cm-rise{ from{opacity:0; transform:translateY(14px) scale(.98);} to{opacity:1; transform:none;} }
.modal-in{ position:relative; padding:24px 26px 26px; }
.modal h3{ font-family:var(--font-ui); margin:0; font-size:17px; font-weight:600; display:flex; align-items:center; gap:10px; letter-spacing:-.3px; }
.modal h3 img{ width:20px; height:20px; }
.modal .x{ position:absolute; top:18px; right:18px; }
.modal .sec-lbl{ font-size:10.5px; letter-spacing:1px; text-transform:uppercase; color:var(--faint); margin:22px 0 10px; }
.typegrid{ display:grid; grid-template-columns:repeat(3,1fr); gap:9px; }
.typecard{ text-align:left; border:1px solid var(--border); background:var(--panel-2); border-radius:11px; padding:13px; color:var(--muted); transition:all .15s; position:relative; }
.typecard:hover{ border-color:#3a4250; color:var(--text); }
.typecard.on{ border-color:var(--accent-line); background:var(--accent-soft); color:var(--text); }
.typecard .ic{ color:var(--accent-2); margin-bottom:9px; display:block; }
.typecard .nm{ font-size:13px; font-weight:600; color:var(--text); }
.typecard .ds{ font-size:11px; margin-top:3px; line-height:1.45; }
.field{ margin-top:6px; }
.field input, .field textarea{ width:100%; background:var(--panel-2); border:1px solid var(--border); border-radius:9px; color:var(--text); font-family:var(--font-ui); font-size:13.5px; padding:11px 13px; outline:none; resize:none; }
.field input:focus, .field textarea:focus{ border-color:var(--accent-line); box-shadow:0 0 0 3px var(--accent-soft); }
.field .hint{ font-size:11px; color:var(--faint); margin-top:6px; }
.opts{ display:flex; gap:8px; flex-wrap:wrap; }
.opt{ border:1px solid var(--border); background:var(--panel-2); color:var(--muted); padding:6px 12px; border-radius:8px; font-size:12px; }
.opt.on{ border-color:var(--accent-line); background:var(--accent-soft); color:var(--accent-2); }
.opt:hover{ color:var(--text); }
.modal-foot{ display:flex; align-items:center; gap:10px; margin-top:26px; }
.modal-foot .sp{ flex:1; }

/* ---- generating state ---- */
.gen{ padding:34px 30px 30px; text-align:center; position:relative; }
.gen .orb{ width:74px; height:74px; margin:6px auto 20px; border-radius:50%; background:var(--spark-grad); box-shadow:0 0 50px -4px rgba(255,160,50,.6), 0 0 0 1px rgba(255,190,90,.4) inset; display:grid; place-items:center; animation:cm-breathe 1.6s ease-in-out infinite; }
/* the brand mark as a recolourable mask: one transparent silhouette, painted
   by `color` per context, so it never carries a clashing background of its own. */
.cm-mark{ display:inline-block; background:currentColor;
  -webkit-mask:url('assets/creator-magic-mask.svg') center/contain no-repeat;
          mask:url('assets/creator-magic-mask.svg') center/contain no-repeat; }
/* mark inside a button inherits the button's ink (currentColor), so on the
   spark button it reads dark-on-gold. Use this, never a coloured emoji: emoji
   are fixed-colour glyphs that vanish on the spark gradient. */
.btn .cm-mark{ width:15px; height:15px; }
.btn.sm .cm-mark{ width:13px; height:13px; }
.gen .orb .cm-mark{ width:40px; height:40px; color:#2a1606; }
@keyframes cm-breathe{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.07); } }
@keyframes cm-spin{ to{ transform:rotate(360deg); } }
.gen h3{ justify-content:center; }
.gen .glog{ text-align:left; margin:22px auto 0; max-width:430px; font-family:var(--font-mono); font-size:12px; line-height:2; color:var(--muted); }
.gen .progress{ height:4px; border-radius:99px; background:#222932; margin:24px auto 0; max-width:430px; overflow:hidden; }
.gen .progress i{ display:block; height:100%; background:var(--spark-grad); border-radius:99px; transition:width .4s ease; }

/* shimmer for streaming text */
.shimmer{ background:linear-gradient(90deg,#2a313c 25%,#3a4350 50%,#2a313c 75%); background-size:200% 100%; animation:cm-sh 1.3s infinite; border-radius:5px; color:transparent!important; }
@keyframes cm-sh{ to{ background-position:-200% 0; } }

/* copied toast */
.toast{ position:fixed; bottom:26px; left:50%; transform:translateX(-50%) translateY(10px); background:var(--panel-2); border:1px solid var(--accent-line); color:var(--text); padding:9px 16px; border-radius:9px; font-size:12px; z-index:60; opacity:0; pointer-events:none; box-shadow:0 10px 30px -10px rgba(0,0,0,.6); transition:opacity .2s, transform .2s; display:flex; align-items:center; gap:8px; }
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

/* entrance — transform-only so content stays visible even if throttled */
.fadein{ animation:cm-dfade .34s ease both; }
@keyframes cm-dfade{ from{ transform:translateY(7px); } to{ transform:none; } }

/* empty state */
.empty{ height:100%; display:grid; place-items:center; text-align:center; color:var(--muted); }
.empty .o{ width:64px;height:64px;border-radius:50%;background:var(--accent-soft);display:grid;place-items:center;margin:0 auto 18px; }
.empty .cm-mark{ width:34px;height:34px; color:#fff; filter:drop-shadow(0 0 12px rgba(255,160,60,.5)); }
.empty h2{ font-family:var(--font-ui); color:var(--text); font-weight:600; font-size:17px; margin:0 0 6px; }

/* ===================== <cm-drawer> : right slide-out =====================
   Behaviour lives in shell.js; this is the look. Off-canvas from the right,
   slides in on .open. Apps just write <cm-drawer> and fill it. */
.drawer{
  position:fixed; top:0; right:0; z-index:50; height:100vh; width:min(440px,92vw);
  display:flex; flex-direction:column; min-height:0;
  background:rgba(16,20,27,.96); backdrop-filter:blur(12px);
  border-left:1px solid var(--border);
  box-shadow:-30px 0 80px -30px rgba(0,0,0,.7);
  transform:translateX(100%); transition:transform .26s cubic-bezier(.2,.8,.25,1);
}
.drawer.open{ transform:none; }
.drawer-head{ display:flex; align-items:center; gap:10px; padding:0 12px 0 18px; height:var(--topbar-h); border-bottom:1px solid var(--border); flex:none; }
.drawer-title{ flex:1; font-family:var(--font-ui); font-weight:600; font-size:14px; letter-spacing:-.2px; }
.drawer-body{ flex:1; min-height:0; overflow-y:auto; padding:18px 20px; }

/* ===================== <cm-chat> : shared chat box =====================
   A message log over the house composer. Look here; transport in shell.js. */
.chat{ display:flex; flex-direction:column; min-height:0; height:100%; }
.chat-log{ flex:1; min-height:0; overflow-y:auto; padding:22px 0; display:flex; flex-direction:column; gap:12px; }
.chat .msg{ max-width:78%; padding:10px 14px; border-radius:13px; font-size:13px; line-height:1.55; white-space:pre-wrap; word-break:break-word; }
.chat .msg.user{ align-self:flex-end; background:var(--accent); color:var(--accent-ink); border-bottom-right-radius:5px; }
.chat .msg.bot{ align-self:flex-start; background:var(--panel-2); color:#c8d2dd; border:1px solid var(--border-soft); border-bottom-left-radius:5px; }
.chat .msg.bot.err{ color:var(--red); border-color:rgba(248,81,73,.4); }
.chat .compose{ padding:14px 0 4px; }

/* ===================== responsive: off-canvas rail =====================
   Below 768px the rail becomes a slide-in drawer revealed by .hamburger
   (markup in shell.html). The toggleRail() controller + backdrop live in
   shell.js. Keeps the desktop two-column .body grid intact above 768px. */
@media (max-width: 768px){
  .hamburger{ display:inline-flex; }
  .topbar{ gap:10px; padding:0 12px; }
  .body{ grid-template-columns:1fr; }
  .rail{
    position:fixed; top:var(--topbar-h); bottom:0; left:0; z-index:45;
    width:min(300px,86vw);
    background:rgba(16,20,27,.97); backdrop-filter:blur(12px);
    transform:translateX(-100%);
    transition:transform .24s cubic-bezier(.2,.8,.25,1);
  }
  body.rail-open .rail{ transform:none; }
  .rail-backdrop{
    display:block; position:fixed; inset:var(--topbar-h) 0 0 0; z-index:44;
    background:rgba(6,8,12,.55); opacity:0; pointer-events:none; transition:opacity .2s ease;
  }
  body.rail-open .rail-backdrop{ opacity:1; pointer-events:auto; }
  .detail{ padding:20px 16px 22px; }
  .compose{ padding:12px 16px 16px; }
  .d-head h1{ font-size:20px; }
  .thumbs{ grid-template-columns:1fr; }
  .typegrid{ grid-template-columns:1fr 1fr; }
  .modal{ width:96vw; }
  .chat .msg{ max-width:88%; }
  table.tbl{ font-size:12.5px; }
  table.tbl th, table.tbl td{ padding:8px 7px; }
}

/* phones: drop columns/elements marked as low-priority */
@media (max-width: 560px){
  .hide-sm{ display:none !important; }
}
