/* ===== Space cowork: canvas, desk, what's new, sandbox ===== */
:root { --k-build: #1f8a7a; --k-idea: #c58a12; --k-job: #7a5cc4; --k-preview: #2f6fd1; --k-note: #8b867c; --k-link: #5a6b7d; }
@media (prefers-color-scheme: dark) { :root { --k-build: #4fc1ad; --k-idea: #e6b14a; --k-job: #ab93f0; --k-preview: #6ea3ff; --k-note: #a5a198; --k-link: #8ea2b8; } }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; margin-left: 6px; }
.small { font-size: 13px; }

.cv-wrap { position: relative; height: 100vh; display: flex; flex-direction: column; }
.cv-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.cv-title { font-size: 16px; }
.cv-legend { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.cv-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; color: var(--ink-2); }
.cv-chip i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.cv-chip.off { opacity: .4; text-decoration: line-through; }
.cv-tools { display: flex; gap: 6px; }
.cv { position: relative; flex: 1; overflow: hidden; cursor: grab; touch-action: none; outline: none;
  background-color: var(--bg); background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 22px 22px; }
.cv.panning { cursor: grabbing; }
.cv.linking .cv-node { cursor: crosshair; }
.cv-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.cv-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; }
.cv-edge path { stroke: var(--ink-3); stroke-width: 1.6; fill: none; }
.cv-edge .cv-edge-hit { stroke: transparent; stroke-width: 14; cursor: pointer; }
.cv-edge.armed path:first-child { stroke: var(--bad); }
.cv-edge text { font-size: 11.5px; fill: var(--ink-2); text-anchor: middle; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; }
.cv-node { position: absolute; background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--kc); border-radius: 12px; padding: 10px 12px 9px; box-shadow: var(--shadow); cursor: pointer; user-select: none; }
.cv-node:hover { border-color: var(--line-strong); border-top-color: var(--kc); }
.cv-node.sel { outline: 2px solid var(--kc); outline-offset: 2px; }
.cv-node-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.cv-kind { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--kc, var(--ink-3)); }
.cv-status { font-size: 11px; padding: 0 7px; border-radius: 999px; background: var(--sunk); color: var(--ink-2); }
.cv-node-title { font-weight: 650; line-height: 1.3; }
.cv-node-body { font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.4; white-space: pre-wrap; }
.cv-node-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 11.5px; color: var(--ink-3); }
.cv-open { font-weight: 600; text-decoration: none; }
.cv-hint { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); color: var(--ink-3); background: var(--panel); border: 1px dashed var(--line-strong); padding: 14px 18px; border-radius: 12px; font-size: 14px; pointer-events: none; text-align: center; max-width: 90%; }
.cv-panel { position: absolute; right: 16px; top: 70px; bottom: 16px; width: 340px; max-width: calc(100% - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; z-index: 5; }
.cv-panel h3 { margin: 4px 0 10px; }
.cv-panel h4 { margin: 16px 0 6px; font-size: 13px; color: var(--ink-2); }
.cv-x { position: absolute; right: 8px; top: 8px; }
.cv-form label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0; color: var(--ink-2); }
.cv-form input, .cv-form textarea, .cv-form select { display: block; width: 100%; margin-top: 5px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); font-weight: 400; color: var(--ink); }
.cv-form .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cv-form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cv-links { margin: 0; padding-left: 18px; font-size: 14px; }

.desk { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: start; }
.desk-col h2 { font-size: 13px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.job { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--k-note); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.job.st-needs_person { border-left-color: var(--warn); }
.job.st-claimed { border-left-color: var(--k-job); }
.job.st-open { border-left-color: var(--k-preview); }
.job.st-done { border-left-color: var(--good); }
.job h3 { margin: 6px 0 4px; font-size: 15px; }
.job-top { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.job-st { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.tag.hi { background: var(--warn-soft); color: var(--warn); }
.job details summary { cursor: pointer; font-size: 13px; color: var(--ink-2); }
.job .body, .panel .body { white-space: pre-wrap; font-size: 14px; margin-top: 6px; }
.job-result { background: var(--sunk); border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 14px; }
.job-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.baton { border-top: 1px solid var(--line); padding: 12px 0; }
.baton .meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--ink-3); }
.baton-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 8px; font-size: 14px; white-space: pre-wrap; }
.baton-grid span { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-bottom: 2px; }
.baton-grid .next { background: var(--accent-soft); border-radius: 8px; padding: 6px 8px; }
.composer .mini { width: 140px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); }
.dotlg { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: var(--ink-3); flex: none; }
.dotlg.on { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 20%, transparent); }
.dotlg.off { background: var(--bad); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }

@media (max-width: 860px) {
  .cv-wrap { height: calc(100vh - 53px); }
  .cv-panel { left: 16px; right: 16px; width: auto; top: auto; max-height: 70%; }
  .baton-grid { grid-template-columns: 1fr; }
}

/* invite flow */
.inv-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inv-form input { flex: 1; min-width: 180px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); }
.inv-ready { margin-top: 14px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 12px; padding: 14px; }
.inv-msg { font-size: 15px; line-height: 1.5; word-break: break-word; user-select: all; }
.inv-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.inv-acts a.btn { text-decoration: none; }
.inv-h { margin: 18px 0 4px; font-size: 13px; color: var(--ink-2); }
.inv-side { margin: 0 8px 8px; justify-content: flex-start; }

/* boards */
.cv-boards { display: flex; gap: 4px; flex-wrap: wrap; }
.cv-board { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; }
.cv-board:hover { background: var(--sunk); color: var(--ink); }
.cv-board.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.cv-board .n { font-size: 11.5px; opacity: .7; font-weight: 500; }
.cv-board .lock { font-size: 12px; }
.cv-ro { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 14px; font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow); white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
.readonly .cv { cursor: default; }
.readonly .cv-node { cursor: pointer; }

/* library */
.lib { display: grid; grid-template-columns: 300px 1fr; height: 100vh; }
.lib-toc { border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 20px 14px 40px; }
.lib-brand { display: flex; flex-direction: column; gap: 2px; padding: 0 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; font-size: 18px; }
.lib-sec { margin-bottom: 16px; }
.lib-sec-h { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 0 8px 6px; }
.lib-sec-h span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
.lib-link { display: block; padding: 6px 8px 6px 36px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-size: 14.5px; line-height: 1.35; }
.lib-link:hover { background: var(--sunk); color: var(--ink); }
.lib-link.on { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.lib-page { overflow-y: auto; padding: 40px 48px 80px; max-width: 760px; }
.lib-crumb { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.lib-page h1 { font-size: 30px; letter-spacing: -.02em; line-height: 1.2; margin: 6px 0 18px; }
.lib-body { white-space: pre-wrap; font-size: 16.5px; line-height: 1.65; color: var(--ink); }
.lib-nav { display: flex; justify-content: space-between; gap: 10px; margin: 32px 0 16px; flex-wrap: wrap; }
.lib-nav a { text-decoration: none; }
@media (max-width: 860px) {
  .lib { grid-template-columns: 1fr; height: auto; }
  .lib-toc { border-right: 0; border-bottom: 1px solid var(--line); max-height: 40vh; }
  .lib-page { padding: 24px 16px 60px; }
  .lib-page h1 { font-size: 24px; }
}
