:root { --bg:#E8ECF0; --panel:#FFFFFF; --ink:#14181B; --muted:#57636C; --line:#E0E3E7; --accent:#3B5DE8;
  --sel:color-mix(in srgb, var(--accent) 14%, transparent); --hover:color-mix(in srgb, var(--line) 55%, transparent);
  --changed:#E07A1F; --left:280px; --right:340px; }
:root[data-theme="dark"] { --bg:#1B1E22; --panel:#24282D; --ink:#E8ECF0; --muted:#9AA4AE; --line:#3A4048; }
* { box-sizing:border-box; }
html, body { margin:0; height:100%; overflow:hidden; background:var(--bg); color:var(--ink);
  font:13px/1.4 'Geist',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; }
button, select { font:inherit; color:inherit; background:var(--panel); border:1px solid var(--line); border-radius:8px;
  padding:3px 8px; height:28px; cursor:pointer; }
button:hover:not(:disabled), select:hover { border-color:var(--muted); }
button:disabled { opacity:.45; cursor:default; }
button.icon { min-width:28px; padding:0 6px; }
button[aria-pressed="true"] { background:var(--ink); color:var(--panel); border-color:var(--ink); }
button.primary { background:var(--accent); color:#fff; border-color:var(--accent); }
code { font-family:ui-monospace,monospace; font-size:.92em; }

/* ── Three columns ── */
#app { display:grid; grid-template-columns:var(--left) 1fr var(--right); height:100vh; }
/* Each column keeps its own track, so hiding a panel never shifts the others into its place. */
#left { grid-column:1; } #stage { grid-column:2; } #right { grid-column:3; }
#app > * { grid-row:1; }
#app.no-left { grid-template-columns:0 1fr var(--right); }
#app.no-left #left { display:none; }
#app.no-right { grid-template-columns:var(--left) 1fr 0; }
#app.no-left.no-right { grid-template-columns:0 1fr 0; }
#app.no-right #right { display:none; }
#left, #right { background:var(--panel); display:flex; flex-direction:column; min-height:0; min-width:0; }
#left { border-right:1px solid var(--line); }
#right { border-left:1px solid var(--line); }
.pane { overflow:auto; min-height:0; }

/* ── Left: files over the tree ── */
#left-head { padding:10px; display:flex; flex-direction:column; gap:8px; border-bottom:1px solid var(--line); }
#search { font:inherit; color:inherit; background:transparent; border:1px solid var(--line); border-radius:8px; padding:5px 8px; }
#search:focus { outline:2px solid var(--accent); outline-offset:-1px; }
#files { flex:0 0 var(--files-h, 42%); padding:6px; }
#split { flex:none; height:7px; cursor:row-resize; border-top:1px solid var(--line); border-bottom:1px solid var(--line);
  background:linear-gradient(var(--muted), var(--muted)) center / 28px 2px no-repeat; }
#tree-head { display:flex; gap:4px; align-items:center; padding:6px 8px; font-weight:600; }
#tree-head span { flex:1; }
#tree-head button { height:24px; min-width:24px; }
#tree { flex:1; padding:0 6px 10px; }
#rev { border-top:1px solid var(--line); padding:6px 10px; color:var(--muted); font-family:ui-monospace,monospace; font-size:11px;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:help; }

.nodes { list-style:none; margin:0; padding-left:14px; }
.nodes.top { padding-left:0; }
.node > .row { display:flex; align-items:center; gap:5px; padding:3px 6px; border-radius:6px; cursor:pointer;
  white-space:nowrap; overflow:hidden; }
.node > .row:hover { background:var(--hover); }
.node > .row.active { background:var(--sel); }
.node > .row .tw { width:12px; flex:none; color:var(--muted); text-align:center; font-size:10px; }
.node > .row .ic { width:14px; flex:none; color:var(--muted); text-align:center; }
.node > .row .lb { overflow:hidden; text-overflow:ellipsis; }
.node > .row .meta { margin-left:auto; color:var(--muted); font-size:11px; padding-left:6px; }
.node.closed > .nodes { display:none; }
.node.dir > .row .lb { font-weight:600; }
.node.section > .row .lb { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.03em; color:var(--muted); }
.node.frame > .row .lb { font-weight:500; }
.dot { width:6px; height:6px; border-radius:50%; background:var(--accent); flex:none; }
.dot.changed { background:var(--changed); }
mark { background:color-mix(in srgb, var(--accent) 25%, transparent); color:inherit; border-radius:2px; }
.hint { color:var(--muted); font-size:12px; padding:8px 6px; }

/* ── Stage: canvas with floating clusters ── */
#stage { position:relative; overflow:hidden; min-width:0; background:#E8ECF0; }
#view { position:absolute; inset:0; cursor:grab; touch-action:none; }
#view.panning, #view.panning * { cursor:grabbing !important; }
#world { position:absolute; left:0; top:0; transform-origin:0 0; }
#frame { display:block; border:0; background:transparent; width:1600px; height:1200px; }
#shield { position:absolute; inset:0; display:none; }
#view.space #shield, #view.panning #shield { display:block; }
.cluster { position:absolute; top:10px; z-index:5; display:flex; gap:4px; align-items:center; background:var(--panel);
  border:1px solid var(--line); border-radius:10px; padding:4px; box-shadow:0 2px 8px rgba(20,24,27,.08); }
#tl { left:10px; }
#tr { right:10px; }
.cluster .sep { width:1px; height:18px; background:var(--line); margin:0 2px; }
#zoom { min-width:42px; text-align:center; color:var(--muted); font-variant-numeric:tabular-nums; }

/* ── Right: details ── */
#right-head { display:flex; align-items:center; gap:6px; padding:8px; border-bottom:1px solid var(--line); }
#rtabs { flex:1; display:flex; }
#rtabs button { flex:1; border-radius:0; margin-left:-1px; }
#rtabs button:first-child { border-radius:8px 0 0 8px; margin-left:0; }
#rtabs button:last-child { border-radius:0 8px 8px 0; }
#rtab-n:not(:empty) { display:inline-block; min-width:16px; padding:0 4px; border-radius:8px; background:#7C5CF0; color:#fff; font-size:11px; line-height:16px; margin-left:4px; }
#crumbs { display:flex; flex-wrap:wrap; gap:2px; align-items:center; padding:8px 12px; border-bottom:1px solid var(--line); }
#crumbs:empty { display:none; }
#left-toggle { flex:none; }
#crumbs a { color:var(--muted); text-decoration:none; cursor:pointer; padding:2px 4px; border-radius:4px; }
#crumbs a:hover { background:var(--hover); color:var(--ink); }
#crumbs a.here { color:var(--ink); font-weight:600; cursor:default; background:none; }
#crumbs .gt { color:var(--muted); }
#detail { flex:1; padding:12px; }
.d-head { display:flex; flex-direction:column; gap:3px; margin-bottom:10px; }
.d-head .t { font-size:15px; font-weight:600; }
.d-head .s { color:var(--muted); }
.d-head .mono { font-family:ui-monospace,monospace; font-size:12px; color:var(--muted); word-break:break-all; }
.d-actions { display:flex; gap:6px; flex-wrap:wrap; margin:6px 0 12px; }
.d-sec { border-top:1px solid var(--line); padding:10px 0 6px; }
.d-sec > h4 { margin:0 0 6px; font-size:11px; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); }
.d-kind { font-size:12px; font-weight:700; margin:16px 0 2px; }
.d-sec table { width:100%; border-collapse:collapse; font-size:12px; }
.d-sec td { padding:4px 4px 4px 0; border-bottom:1px solid var(--line); vertical-align:top; word-break:break-word; }
.d-sec td:first-child { font-family:ui-monospace,monospace; font-weight:500; }
.d-sec td.n { text-align:end; color:var(--muted); white-space:nowrap; }
.d-sec pre { margin:0; font-size:12px; white-space:pre-wrap; background:var(--hover); padding:8px; border-radius:8px; }
.d-sec ul { margin:0; padding-inline-start:18px; font-size:12.5px; line-height:1.5; }
.d-sec li { margin-bottom:5px; }
.d-sec p { margin:0 0 6px; font-size:13px; line-height:1.5; }
.d-sec dl { margin:0; display:grid; grid-template-columns:auto 1fr; gap:4px 10px; font-size:12px; }
.d-sec dt { color:var(--muted); }
.d-sec dd { margin:0; word-break:break-word; font-family:ui-monospace,monospace; }
.parts { list-style:none; margin:0; padding:0; }
.parts li { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:2px 8px; padding:6px 6px; border-radius:6px; border-bottom:1px solid var(--line); }
.parts li.pick { cursor:pointer; }
.parts li.pick:hover { background:var(--hover); }
.parts li.active { background:var(--sel); }
.parts .nm { font-weight:600; }
.parts .nm::before { content:"◇ "; color:var(--muted); font-weight:400; }
.parts li.pick .nm::before { color:var(--accent); }
.parts .ct { color:var(--muted); font-size:12px; }
.parts .pr { grid-column:1 / -1; color:var(--muted); font-size:12px; line-height:1.45; word-break:break-word; }
.chips { display:flex; gap:4px; flex-wrap:wrap; margin-top:3px; }
.chip { font-size:11px; padding:1px 6px; border-radius:9999px; border:1px solid var(--line); color:var(--muted); text-decoration:none; white-space:nowrap; }
.chip.changed { color:#fff; background:var(--changed); border-color:var(--changed); }
a.chip:hover { border-color:var(--accent); color:var(--accent); }
.chain span { cursor:pointer; font-family:ui-monospace,monospace; font-size:12px; }
.chain span:hover { color:var(--accent); }
textarea.ref { width:100%; font-family:ui-monospace,monospace; font-size:12px; border:1px solid var(--line); border-radius:8px;
  padding:6px; resize:vertical; min-height:56px; background:transparent; color:inherit; }
.list-btn { display:block; width:100%; height:auto; text-align:left; border:0; border-radius:6px; padding:5px 6px; background:transparent; }
.list-btn:hover { background:var(--hover); }
.list-btn .sub { color:var(--muted); font-size:12px; display:block; }

#toast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); background:var(--ink); color:var(--panel);
  padding:6px 12px; border-radius:8px; z-index:60; opacity:0; transition:opacity .15s; pointer-events:none; }
#toast.on { opacity:1; }

/* ── Prototype window ── */
#proto-window { position:fixed; inset:0; z-index:40; background:var(--bg); display:grid;
  grid-template-columns:var(--proto-side, 260px) 1fr; grid-template-rows:auto 1fr; }
#proto-window[hidden] { display:none; }
#proto-window header { grid-column:1 / -1; display:flex; gap:8px; align-items:center; padding:10px 12px;
  background:var(--panel); border-bottom:1px solid var(--line); }
#proto-window header .grow { flex:1; }
#proto-window .seg { display:inline-flex; }
#proto-window .seg button { border-radius:0; margin-left:-1px; }
#proto-window .seg button:first-child { border-radius:8px 0 0 8px; margin-left:0; }
#proto-window .seg button:last-child { border-radius:0 8px 8px 0; }
#proto-controls { overflow:auto; padding:12px; border-right:1px solid var(--line); background:var(--panel); }
#proto-frame { width:100%; height:100%; border:0; background:var(--bg); }
.pc-group { margin-bottom:14px; }
.pc-label { font-size:11px; font-weight:600; text-transform:uppercase; color:var(--muted); margin-bottom:6px; }
.pc-buttons { display:flex; flex-wrap:wrap; gap:4px; }
.pc-buttons button { height:auto; min-height:28px; padding:4px 8px; font-size:12px; }

@media (max-width:900px) {
  #app { grid-template-columns:0 1fr 0; }
  #left, #right { display:none; }
}
/* A narrow canvas can't fit both clusters on one line: the actions drop below the view controls. */
#stage { container-type:size; }
@container (max-width: 800px) { #tr { top:56px; } }
#proto-pct { min-width:56px; font-variant-numeric:tabular-nums; }

/* Drag handles on the panels' inner edges: drag to resize, double-click to expand or restore. */
#left, #right { position:relative; }
.grip { position:absolute; top:0; bottom:0; width:7px; z-index:6; cursor:col-resize; }
.grip::after { content:""; position:absolute; top:0; bottom:0; left:3px; width:1px; background:transparent; transition:background .15s; }
.grip:hover::after, .grip.dragging::after { background:var(--accent); width:2px; }
#grip-left { right:-4px; }
#grip-right { left:-4px; }
#grip-proto { position:fixed; z-index:45; top:49px; bottom:0; left:calc(var(--proto-side, 260px) - 4px); }
#proto-window[hidden] + #grip-proto, #proto-window[hidden] #grip-proto { display:none; }
body.resizing, body.resizing * { cursor:col-resize !important; user-select:none !important; }
body.resizing iframe { pointer-events:none; }

/* File and tree icons: a board is an artboard, a component the four-diamond mark, a screen a page. */
.ic svg { width:14px; height:14px; display:block; }
.ic.board { color:var(--muted); }
.ic.comp { color:#7C5CF0; }
.ic.screen { color:#1B7167; }
.ic.dir { color:var(--muted); }

/* Comments */
#comment[aria-pressed="true"], #proto-comment[aria-pressed="true"] { background:#7C5CF0; border-color:#7C5CF0; color:#fff; }
.cm-item { padding:8px 6px; border-radius:8px; border-bottom:1px solid var(--line); }
.cm-item.focus { background:color-mix(in srgb, #7C5CF0 12%, transparent); }
.cm-item.sent { opacity:.6; }
.cm-top { display:flex; gap:6px; align-items:center; font-size:12px; color:var(--muted); }
.cm-n { min-width:20px; height:20px; border-radius:10px 10px 10px 2px; background:#7C5CF0; color:#fff; font-weight:700; font-size:11px;
  display:inline-flex; align-items:center; justify-content:center; padding:0 5px; }
.cm-item.sent .cm-n { background:#95A1AC; }
.cm-on { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cm-text { margin:4px 0 4px 26px; font-size:13px; line-height:1.45; white-space:pre-wrap; }
.cm-acts { margin-left:26px; display:flex; gap:10px; font-size:12px; }
.cm-acts a { color:var(--accent); cursor:pointer; }
button.icon svg { display:block; margin:auto; }

/* A board's own header, in the Info tab */
.board-meta .eyebrow { font-size:11px; font-weight:600; color:var(--muted); }
.board-meta .t.big { font-size:18px; line-height:1.25; }
.board-meta .subtitle p { margin:6px 0 0; color:var(--muted); font-size:13px; line-height:1.5; }
.fld { display:flex; flex-direction:column; gap:4px; font-size:11px; font-weight:600; color:var(--muted); margin-bottom:8px; }
.fld input, .fld textarea { font:inherit; font-size:13px; font-weight:400; color:var(--ink); background:transparent; border:1px solid var(--line); border-radius:8px; padding:6px 8px; resize:vertical; }

/* The details panel floats: a rounded card inset from the window, over the canvas's own ground. */
#app { background:#E8ECF0; }
#right { margin:10px 10px 10px 0; border:1px solid var(--line); border-radius:14px;
  box-shadow:0 8px 24px rgba(20,24,27,.10), 0 1px 3px rgba(20,24,27,.06); }
#right #grip-right { left:-4px; z-index:7; }
#right-head { border-radius:14px 14px 0 0; }
.name-line { display:flex; align-items:center; gap:6px; }
.name-line .eyebrow { flex:1; }
button.ghost { border-color:transparent; background:transparent; height:24px; min-width:24px; color:var(--muted); }
button.ghost:hover { border-color:var(--line); color:var(--ink); }
/* The files-and-tree panel floats too, mirroring the details panel. */
#left { margin:10px 0 10px 10px; border:1px solid var(--line); border-radius:14px;
  box-shadow:0 8px 24px rgba(20,24,27,.10), 0 1px 3px rgba(20,24,27,.06); }
#left-head { border-radius:14px 14px 0 0; }
#rev { border-radius:0 0 14px 14px; }
#left #grip-left { right:-4px; z-index:7; }

/* ── The project head: ← back to the projects, the project's name, the repo under it ── */
#proj-head { display:flex; align-items:center; gap:6px; }
#proj-head .ph { display:flex; flex-direction:column; min-width:0; }
#proj-head strong { font-size:14px; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#home-btn { height:28px; min-width:28px; font-size:15px; }
button.linkish { border:0; background:none; padding:0; height:auto; font-size:11px; color:var(--muted); text-align:left; cursor:pointer; }
button.linkish:hover { color:var(--accent); text-decoration:underline; }
.mono { font-family:ui-monospace,monospace; font-size:12px; }
.muted { color:var(--muted); }

/* ── Home: the repo's projects ── */
#app[hidden], #home[hidden] { display:none !important; }
#home { position:fixed; inset:0; overflow:auto; background:var(--bg); }
.home-wrap { max-width:1080px; margin:0 auto; padding:40px 24px; }
.home-head { display:flex; align-items:flex-end; justify-content:space-between; gap:16px; margin-bottom:24px; }
.home-acts { display:flex; gap:8px; align-items:center; }
.imp-report ul { margin:4px 0 8px; padding-left:18px; max-height:180px; overflow:auto; font-size:12px; }
.imp-report p { margin:0 0 6px; font-size:13px; }
.home-head h1 { margin:0 0 4px; font-size:22px; letter-spacing:-.01em; }
#new-project { height:34px; padding:0 14px; }
#import-figma { height:34px; padding:0 14px; }
.fig-report ul { margin:4px 0 8px; padding-left:18px; max-height:180px; overflow:auto; font-size:12px; }
.fig-report p { margin:0 0 6px; font-size:13px; }
#home-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:16px; }
.pcard { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:16px; display:flex; flex-direction:column; gap:8px;
  cursor:pointer; box-shadow:0 1px 3px rgba(20,24,27,.06); transition:border-color .15s, box-shadow .15s; }
.pcard:hover, .pcard:focus-visible { border-color:var(--accent); box-shadow:0 8px 24px rgba(20,24,27,.10); outline:none; }
.pcard.last { border-color:color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pc-top { display:flex; align-items:center; gap:8px; }
.pc-name { font-size:16px; font-weight:600; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pc-folder { color:var(--muted); margin-top:-6px; }
.pc-desc { margin:0; color:var(--muted); line-height:1.45; }
.pc-err { margin:0; color:#C0392B; }
.pc-stats { display:flex; gap:12px; font-weight:500; }
.pc-libs, .pc-last { font-size:12px; color:var(--muted); }
.pc-last { border-top:1px solid var(--line); padding-top:8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.badge { font-size:11px; font-weight:600; padding:2px 8px; border-radius:9999px; background:var(--hover); color:var(--muted); }
.badge.library { background:color-mix(in srgb, #7C5CF0 16%, transparent); color:#6A4BD8; }

/* ── Dialogs: New project, project settings ── */
#dlg { border:1px solid var(--line); border-radius:14px; padding:20px; width:min(480px, calc(100vw - 32px)); background:var(--panel); color:var(--ink);
  box-shadow:0 24px 64px rgba(20,24,27,.25); }
#dlg::backdrop { background:rgba(20,24,27,.35); }
#dlg h2 { margin:0 0 14px; font-size:17px; }
#dlg fieldset.fld { border:0; padding:0; margin:0 0 8px; }
#dlg legend { padding:0; margin-bottom:4px; }
.chk { display:flex; align-items:baseline; gap:6px; font-size:13px; font-weight:400; color:var(--ink); padding:3px 0; }
.dlg-acts { display:flex; justify-content:flex-end; gap:8px; margin-top:12px; }
.dlg-err { color:#C0392B; font-size:12px; }
.dlg-err ul { margin:4px 0 0; padding-left:18px; }

/* ── Git: the checkout switcher (left footer) and the Changes tab ── */
#left { position:relative; }
#rev { padding:4px; font-family:inherit; cursor:default; }
.co-switch { width:100%; height:auto; display:flex; align-items:center; gap:8px; text-align:left; border-color:transparent; background:transparent; padding:6px 8px; }
.co-switch:hover { background:var(--hover); }
.co-ic { width:16px; text-align:center; color:var(--muted); flex:none; }
.co-lb { display:flex; flex-direction:column; min-width:0; flex:1; line-height:1.25; }
.co-lb b { font-size:12px; color:var(--ink); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.co-lb .mono { font-size:11px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.co-n { font-size:11px; color:var(--changed); white-space:nowrap; }
.co-menu { position:absolute; left:8px; right:8px; bottom:54px; z-index:20; background:var(--panel); border:1px solid var(--line); border-radius:12px;
  box-shadow:0 12px 32px rgba(20,24,27,.18); padding:6px; max-height:60vh; overflow:auto; display:flex; flex-direction:column; gap:2px; }
.co-h { font-size:11px; font-weight:600; color:var(--muted); padding:6px 8px 2px; text-transform:uppercase; letter-spacing:.04em; }
.co-item { height:auto; display:flex; align-items:center; gap:8px; text-align:left; border-color:transparent; background:transparent; padding:6px 8px; }
.co-item:hover { background:var(--hover); }
.co-item.on { background:var(--sel); }
.co-new { margin-top:6px; }
.chip.pr-open { color:#1A7F37; border-color:#1A7F37; } .chip.pr-merged { color:#8250DF; border-color:#8250DF; } .chip.pr-closed { color:#C0392B; border-color:#C0392B; }
.co-rm { cursor:pointer; }
.ch-file { display:flex; align-items:center; gap:6px; padding:3px 0; }
.ch-path { flex:1; min-width:0; font-family:ui-monospace,monospace; font-size:12px; color:var(--ink); cursor:pointer; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; direction:rtl; text-align:left; }
.ch-path:hover { color:var(--accent); text-decoration:underline; }
.chip.st-added { color:#1A7F37; border-color:#1A7F37; } .chip.st-deleted { color:#C0392B; border-color:#C0392B; } .chip.st-modified { color:var(--changed); border-color:var(--changed); }
.ch-all { margin-bottom:2px; }
#dlg form.wide { width:min(900px, calc(100vw - 64px)); }
#dlg:has(form.wide), #dlg:has(form.cmp) { width:auto; max-width:calc(100vw - 32px); }
pre.diff { margin:0; max-height:65vh; overflow:auto; font-size:12px; line-height:1.45; background:var(--bg); border-radius:8px; padding:10px; white-space:pre-wrap; word-break:break-word; }
pre.diff .add { color:#1A7F37; background:color-mix(in srgb, #1A7F37 10%, transparent); display:inline-block; width:100%; }
pre.diff .del { color:#C0392B; background:color-mix(in srgb, #C0392B 10%, transparent); display:inline-block; width:100%; }
pre.diff .hunk { color:var(--accent); }
form.cmp { width:calc(100vw - 96px); height:calc(100vh - 120px); display:flex; flex-direction:column; gap:10px; }
.cmp-head { display:flex; align-items:center; gap:8px; } .cmp-head h2 { margin:0 !important; } .grow { flex:1; }
.cmp-panes { flex:1; display:grid; grid-template-columns:1fr 1fr; gap:12px; min-height:0; }
.cmp-panes figure { margin:0; display:flex; flex-direction:column; gap:6px; min-height:0; }
.cmp-panes figcaption { font-size:12px; font-weight:600; color:var(--muted); }
.cmp-panes iframe { flex:1; width:100%; border:1px solid var(--line); border-radius:10px; background:#E8ECF0; }

/* ── Claude: a chat on a change (claude.js) ── */
.k-pane { display:flex; flex-direction:column; gap:8px; }
.k-bar { display:flex; align-items:center; gap:6px; } .k-bar select { flex:1; min-width:0; } .k-via { white-space:nowrap; }
.k-thread { min-height:160px; max-height:min(52vh, 560px); overflow:auto; display:flex; flex-direction:column; gap:6px; font-size:12.5px; border:1px solid var(--line); border-radius:10px; padding:10px; background:var(--bg); }
.k-thread > * { flex-shrink:0; }
.k-msg { line-height:1.5; white-space:pre-wrap; word-break:break-word; }
.k-user { align-self:flex-end; max-width:88%; background:var(--accent); color:#fff; padding:6px 10px; border-radius:12px 12px 4px 12px; max-height:180px; overflow:auto; }
.k-text { padding:2px 2px; }
.k-tool, .k-note { color:var(--muted); font-size:11.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; } .k-tool b { color:var(--ink); font-weight:600; }
.k-tool .mono, .k-note .mono { font-family:ui-monospace,monospace; }
.k-err { color:#C0392B; white-space:pre-wrap; word-break:break-word; font-size:12px; }
.k-end { display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding-bottom:6px; border-bottom:1px dashed var(--line); }
.k-files { display:flex; flex-wrap:wrap; gap:4px; }
.k-file { font-family:ui-monospace,monospace; font-size:11px; padding:1px 7px; border-radius:9999px; color:var(--changed); border-color:color-mix(in srgb, var(--changed) 50%, var(--line)); }
.k-work { color:var(--muted); font-size:12px; display:flex; align-items:center; gap:6px; }
.k-dot { width:8px; height:8px; border-radius:50%; background:var(--accent); animation:k-pulse 1.2s ease-in-out infinite; }
@keyframes k-pulse { 50% { opacity:.25; } }
.k-compose { display:flex; flex-direction:column; gap:6px; }
.k-compose textarea { font:inherit; color:inherit; background:transparent; border:1px solid var(--line); border-radius:8px; padding:6px 8px; resize:vertical; }
.k-compose textarea:focus { outline:2px solid var(--accent); outline-offset:-1px; }
.k-setup summary { cursor:pointer; list-style:none; } .k-setup summary h4 { display:inline; }
.k-setup summary::before { content:'▸ '; color:var(--muted); } .k-setup[open] summary::before { content:'▾ '; }
.k-row { display:flex; align-items:center; gap:6px; margin-top:6px; flex-wrap:wrap; } .k-row b { min-width:64px; }
.k-row input { flex:1; min-width:120px; font:inherit; color:inherit; background:transparent; border:1px solid var(--line); border-radius:8px; padding:4px 8px; }
.k-token { margin-top:8px; padding:8px; border:1px solid var(--line); border-radius:8px; font-size:12px; }
.k-token pre { white-space:pre-wrap; word-break:break-all; background:var(--bg); padding:6px; border-radius:6px; margin:6px 0; }
.k-pane .sub { color:var(--muted); font-size:12px; }
.k-st { font-size:11px; font-weight:600; padding:1px 6px; border-radius:9999px; background:var(--hover); color:var(--muted); }
.k-st.st-running { background:color-mix(in srgb, #1A7F37 14%, transparent); color:#1A7F37; }
#rtabs button { white-space:nowrap; padding:3px 6px; }
/* ── Library: every component the project reaches, in variants (library.js) ── */
#library[hidden] { display:none !important; }
#library { position:fixed; inset:0; z-index:20; display:flex; flex-direction:column; background:var(--bg); }
.lib-head { display:flex; align-items:center; gap:8px; padding:10px 16px; background:var(--panel); border-bottom:1px solid var(--line); }
.lib-title { display:flex; align-items:baseline; gap:8px; margin-right:auto; }
.lib-title strong { font-size:15px; }
#lib-search { font:inherit; color:inherit; background:transparent; border:1px solid var(--line); border-radius:8px; padding:5px 8px; width:min(280px, 40vw); }
#lib-search:focus { outline:2px solid var(--accent); outline-offset:-1px; }
#lib-body { flex:1; overflow:auto; padding:8px 16px 40px; }
.lib-sec[hidden] { display:none; }
.lib-sec h2 { font-size:13px; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); margin:16px 0 10px; }
.lib-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(340px, 1fr)); gap:14px; align-items:start; }
.lib-card { background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:12px; display:flex; flex-direction:column; gap:8px;
  min-width:0; box-shadow:0 1px 3px rgba(20,24,27,.06); }
.lib-card[hidden] { display:none; }
.lib-card.wide { grid-column:1 / -1; }
.lib-card.flash { animation:lib-flash 1.2s ease-out; }
@keyframes lib-flash { from { box-shadow:0 0 0 3px var(--accent); } to { box-shadow:0 0 0 3px transparent; } }
.lib-card > header { display:flex; align-items:center; gap:6px; min-width:0; }
.lib-card > header strong { font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lib-card > header .grow { flex:1; }
.lib-ic { color:#7C5CF0; }
.lib-nv { font-size:11px; white-space:nowrap; }
.lib-uses { font-size:11px; font-weight:600; min-width:22px; text-align:center; padding:2px 7px; border-radius:9999px; background:var(--sel); color:var(--accent); }
.lib-card.unused .lib-uses { background:var(--hover); color:var(--muted); }
.lib-open { height:26px; }
.lib-path { font-size:11px; margin-top:-4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* The preview keeps the canvas's light ground in dark mode too. */
.lib-prev { position:relative; background:#E8ECF0; border-radius:8px; min-height:80px; max-height:560px; overflow:auto; }
.lib-sizer { position:relative; overflow:hidden; }
.lib-sizer iframe { position:absolute; left:0; top:0; border:0; transform-origin:0 0; background:transparent; }
.lib-status { position:absolute; left:10px; top:10px; font-size:11px; color:#57636C; }
.lib-status[hidden] { display:none; }
.lib-card.lib-err .lib-status { position:static; padding:6px 10px; color:#C0392B; }
.lib-where summary { cursor:pointer; color:var(--muted); font-size:12px; }
.lib-where[open] summary { margin-bottom:6px; }
.lib-board { display:flex; flex-wrap:wrap; align-items:center; gap:4px; padding:3px 0; font-size:12px; }
.lib-board > span { margin-right:4px; }
.lib-board .chip { height:22px; padding:0 8px; font-size:11px; border-radius:9999px; }

/* ── Home: the repos row ── */
#home-repos { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:20px; }
.hr-h { font-size:11px; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.04em; margin-right:4px; }
.hr-chip { display:flex; flex-direction:column; padding:6px 12px; border:1px solid var(--line); border-radius:10px; background:var(--panel); color:var(--ink); text-decoration:none; line-height:1.25; }
.hr-chip:hover { border-color:var(--accent); }
.hr-chip.on { border-color:var(--accent); box-shadow:0 0 0 2px var(--sel); }
.hr-chip .mono { font-size:11px; color:var(--muted); }
.gh-list { max-height:50vh; overflow:auto; display:flex; flex-direction:column; gap:2px; }
.cm-by { font-size:11px; color:var(--muted); margin-left:auto; padding-right:4px; }
.who { display:inline-flex; align-items:center; gap:6px; font-size:12px; color:var(--muted); margin-left:8px; } .who img { width:22px; height:22px; border-radius:50%; }
