/* canvasx.css — Milanote-style full-screen canvas. Tokens only — no raw hexes except card tints. */

body.cvx-open { overflow: hidden; }
body.cvx-open .mobile-nav, body.cvx-open #bmoFab { display: none !important; }

#cvxRoot { position: fixed; inset: 0; z-index: 120; background: var(--bg2); }

.cvx-vp { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: default; }
.cvx-vp.spacepan, .cvx-vp.panning { cursor: grab; }
.cvx-vp.panning { cursor: grabbing; }
.cvx-vp.drawing { cursor: crosshair; }

.cvx-world { position: absolute; top: 0; left: 0; transform-origin: 0 0;
  background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 26px 26px; }
.cvx-cards { position: absolute; inset: 0; }
.cvx-svg { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.cvx-svg path { pointer-events: stroke; }
.cvx-labels { position: absolute; inset: 0; pointer-events: none; }

/* ---- chrome: top bar, rail, zoom ---- */
.cvx-top { position: absolute; top: 14px; left: 14px; display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 6px 10px 6px 6px;
  box-shadow: var(--shadow-2, 0 4px 16px rgba(20,20,43,.08)); z-index: 40; max-width: min(70vw, 640px); }
.cvx-home { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  border: 0; border-radius: 9px; background: var(--accent); color: #fff; cursor: pointer; }
.cvx-home:active { transform: scale(.96); }
.cvx-crumbs { display: flex; align-items: center; gap: 2px; overflow: hidden; white-space: nowrap; }
.cvx-crumbs .sep { color: var(--text3); padding: 0 2px; }
.cvx-crumbs .crumb { border: 0; background: none; color: var(--text2); font: inherit; font-size: 13.5px;
  padding: 4px 7px; border-radius: 8px; cursor: pointer; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.cvx-crumbs .crumb:hover { background: var(--bg3); }
.cvx-crumbs .crumb.cur { color: var(--text); font-weight: 700; }

.cvx-rail { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column;
  gap: 2px; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; padding: 7px;
  box-shadow: var(--shadow-2, 0 4px 16px rgba(20,20,43,.08)); z-index: 40; max-height: calc(100vh - 140px); overflow-y: auto; }
.cvx-tool { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 54px; padding: 7px 2px 6px;
  border: 0; border-radius: 10px; background: none; color: var(--text2); cursor: grab; font-size: 10.5px; }
.cvx-tool svg { color: var(--accent-text); }
.cvx-tool:hover { background: var(--bg3); color: var(--text); }
.cvx-tool:active { transform: scale(.95); }

.cvx-zoom { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 2px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 4px;
  box-shadow: var(--shadow-2, 0 4px 16px rgba(20,20,43,.08)); z-index: 40; }
.cvx-zoom button { border: 0; background: none; color: var(--text2); border-radius: 8px; padding: 6px 8px; cursor: pointer; font: inherit; font-size: 12px; }
.cvx-zoom button:hover { background: var(--bg3); color: var(--text); }
.cvx-zoom .pct { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }

.cvx-ghost { position: fixed; z-index: 200; pointer-events: none; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--text2);
  background: var(--bg); border: 1px solid var(--accent); border-radius: 10px; padding: 8px 10px; opacity: .9;
  box-shadow: var(--shadow-2, 0 8px 24px rgba(20,20,43,.14)); }

.cvx-band { position: absolute; z-index: 60; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); pointer-events: none; }

.cvx-drawbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 6px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 7px 9px; z-index: 45;
  box-shadow: var(--shadow-2, 0 4px 16px rgba(20,20,43,.08)); }
.cvx-drawbar button { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--border); background: var(--bg);
  color: var(--text2); border-radius: 8px; padding: 5px 9px; cursor: pointer; font: inherit; font-size: 12.5px; }
.cvx-drawbar button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.cvx-drawbar .dw-color { width: 30px; height: 30px; border: 1px solid var(--border); border-radius: 8px; background: none; padding: 2px; cursor: pointer; }
.cvx-drawbar select { border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 12.5px; padding: 5px; }

/* ---- cards ---- */
.cvx-card { position: absolute; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 1px 3px rgba(20, 20, 43, .07), 0 6px 18px rgba(20, 20, 43, .05); user-select: none; }
.cvx-card.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.cvx-card textarea, .cvx-card input { user-select: text; }

.cvx-dot { position: absolute; top: -6px; right: -6px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg); cursor: crosshair; opacity: 0; transition: opacity 120ms var(--ease-out, ease); z-index: 5; }
.cvx-card:hover .cvx-dot, .cvx-card.sel .cvx-dot { opacity: 1; }
.cvx-card.docked .cvx-dot, .cvx-card.docked .cvx-resize { display: none; }

.cvx-resize { position: absolute; right: -4px; bottom: -4px; width: 14px; height: 14px; cursor: nwse-resize; opacity: 0; z-index: 5; }
.cvx-resize::after { content: ''; position: absolute; right: 4px; bottom: 4px; width: 8px; height: 8px;
  border-right: 2px solid var(--text3); border-bottom: 2px solid var(--text3); border-radius: 1px; }
.cvx-card:hover .cvx-resize, .cvx-card.sel .cvx-resize { opacity: 1; }

.cvx-note-in { width: 100%; border: 0; background: none; resize: none; font: inherit; font-size: 13.5px; line-height: 1.45;
  color: var(--text); padding: 12px 13px; border-radius: 10px; overflow: hidden; display: block; min-height: 44px; }
.cvx-note-in:focus { outline: none; }

.t-heading { background: none; border-color: transparent; box-shadow: none; }
.t-heading:hover { border-color: var(--border); }
.cvx-head-in { width: 100%; min-width: 120px; border: 0; background: none; font-weight: 800; font-size: 24px; letter-spacing: -.01em;
  color: var(--text); padding: 8px 10px; }
.cvx-head-in:focus { outline: none; }

.t-todo { padding: 10px 12px 8px; }
.cvx-todo-title { width: 100%; border: 0; background: none; font-weight: 700; font-size: 13.5px; color: var(--text); padding: 2px 2px 7px; }
.cvx-todo-title:focus { outline: none; }
.cvx-todo-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.cvx-todo-item input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); flex: 0 0 auto; }
.cvx-todo-item .ti { flex: 1; border: 0; background: none; font: inherit; font-size: 13px; color: var(--text); min-width: 0; }
.cvx-todo-item .ti:focus { outline: none; }
.cvx-todo-item.done .ti { text-decoration: line-through; color: var(--text3); }
.cvx-todo-item .tx { border: 0; background: none; color: var(--text3); cursor: pointer; opacity: 0; padding: 2px; border-radius: 5px; }
.cvx-todo-item:hover .tx { opacity: 1; }
.cvx-todo-add { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; color: var(--accent-text);
  font: inherit; font-size: 12px; font-weight: 600; padding: 6px 2px 2px; cursor: pointer; }

.t-column { background: color-mix(in srgb, var(--bg3) 72%, transparent); border-style: dashed; padding: 9px 9px 10px; }
.t-column.drop { outline: 2px dashed var(--accent); outline-offset: 2px; }
.cvx-col-title { width: 100%; border: 0; background: none; font-weight: 800; font-size: 12.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--text2); padding: 2px 4px 8px; }
.cvx-col-title:focus { outline: none; }
.cvx-col-body { display: flex; flex-direction: column; gap: 8px; min-height: 44px; }
.cvx-col-body .cvx-card { position: relative; width: 100% !important; left: auto !important; top: auto !important; z-index: auto !important; }
.cvx-col-empty { border: 1.5px dashed var(--border); border-radius: 9px; color: var(--text3); font-size: 12px;
  display: flex; align-items: center; justify-content: center; min-height: 44px; }
.cvx-card.dragging-src { opacity: .35; }
.cvx-dragclone { position: fixed; z-index: 210; pointer-events: none; transform: translate(-30px, -14px) rotate(1.5deg); opacity: .92; }

.t-board { padding: 16px 14px 13px; text-align: center; cursor: pointer; }
.cvx-board-tile { width: 46px; height: 46px; border-radius: 13px; background: var(--accent-soft, var(--bg3));
  color: var(--accent-text); display: flex; align-items: center; justify-content: center; margin: 0 auto 9px; }
.cvx-board-name { font-weight: 700; font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cvx-board-count { font-size: 11.5px; color: var(--text3); margin-top: 2px; }

.t-image { overflow: hidden; }
.t-image img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 9px; pointer-events: none; }
.t-image .cvx-cap { position: absolute; left: 0; right: 0; bottom: 0; background: var(--scrim, rgba(15,15,30,.55));
  color: #fff; font-size: 11.5px; padding: 5px 9px; border-radius: 0 0 9px 9px; }

.t-file { padding: 11px 12px; }
.cvx-file-row { display: flex; align-items: center; gap: 9px; color: var(--text2); }
.cvx-file-meta .nm { color: var(--text); font-size: 13px; font-weight: 600; text-decoration: none; word-break: break-all; }
.cvx-file-meta .nm:hover { color: var(--accent-text); }

.t-link { padding: 11px 12px 9px; }
.cvx-link-a { display: flex; align-items: flex-start; gap: 7px; color: var(--accent-text); text-decoration: none; font-size: 13px; font-weight: 600; }
.cvx-link-a .lt { word-break: break-word; }
.cvx-link-a:hover .lt { text-decoration: underline; }
.cvx-link-host { color: var(--text3); font-size: 11.5px; margin: 4px 0 0 22px; }

.t-color { display: flex; align-items: flex-end; min-height: 90px; border: 1px solid rgba(0,0,0,.06); }
.cvx-swatch-hex { font-size: 11.5px; font-weight: 700; letter-spacing: .03em; background: var(--bg);
  color: var(--text2); border-radius: 7px; padding: 3px 7px; margin: 9px; }

.t-comment { background: var(--orange-soft, #FEF3C7); }
.cvx-com-head { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--orange-ink, #92400E); padding: 9px 13px 0; }
.t-comment .cvx-note-in { padding-top: 5px; }

/* ---- svg: lines + strokes ---- */
.cvx-line { fill: none; stroke-linecap: round; cursor: pointer; }
.cvx-line.sel { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent) 60%, transparent)); }
.cvx-line.temp { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 6 5; pointer-events: none; }
.cvx-stroke { fill: none; stroke-linecap: round; stroke-linejoin: round; cursor: pointer; }
.cvx-stroke.sel { filter: drop-shadow(0 0 3px color-mix(in srgb, var(--accent) 70%, transparent)); }

.cvx-line-label { position: absolute; transform: translate(-50%, -50%); background: var(--bg); border: 1px solid var(--border);
  color: var(--text2); font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; pointer-events: none; white-space: nowrap; }
.cvx-lh { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: var(--bg); border: 2.5px solid var(--accent);
  transform: translate(-50%, -50%); pointer-events: auto; cursor: grab; z-index: 6; }
.cvx-lh.mid { width: 11px; height: 11px; border-color: var(--orange-fill, #F59E0B); }

.cvx-linebar { position: absolute; z-index: 46; display: flex; align-items: center; gap: 4px; transform: translateX(-50%);
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 5px 6px;
  box-shadow: var(--shadow-2, 0 4px 16px rgba(20,20,43,.1)); }
.cvx-linebar button { border: 0; background: none; color: var(--text2); border-radius: 7px; padding: 4px 6px; cursor: pointer; font: inherit; font-size: 12px; }
.cvx-linebar button:hover { background: var(--bg3); }
.cvx-linebar .lb-c { width: 18px; height: 18px; border-radius: 50%; padding: 0; border: 2px solid var(--bg2); }
.cvx-linebar .lb-sep { width: 1px; height: 18px; background: var(--border); margin: 0 3px; }

.cvx-colopt { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border); vertical-align: -2px; margin-right: 4px; }

/* mobile: keep it usable, hide labels */
@media (max-width: 840px) {
  .cvx-rail { left: 8px; padding: 5px; }
  .cvx-tool { width: 44px; }
  .cvx-tool span { display: none; }
  .cvx-top { max-width: calc(100vw - 90px); }
}

@media (prefers-reduced-motion: reduce) {
  .cvx-dot, .cvx-resize { transition: none; }
}

/* the display:flex rules above must not defeat the hidden attribute */
#cvxRoot [hidden] { display: none !important; }
