:root {
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #111a2b;
  --panel-2: #172238;
  --panel-3: #1e2b45;
  --line: #2a3956;
  --line-strong: #3b4e70;
  --text: #f1f5ff;
  --muted: #9cabc4;
  --accent: #6d8cff;
  --accent-2: #4f6fe7;
  --danger: #ef6a73;
  --success: #5fd39a;
  --topbar: 40px;
  --sidebar: 238px;
  --bottom: 0px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
.app-shell { height: 100dvh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); grid-template-rows: var(--topbar) minmax(0, 1fr); grid-template-areas: "top top" "side work"; }

/* Do not expose editable local content while the authoritative shared workspace is resolving. */
body.shared-workspace-pending #app { pointer-events: none; }
body.shared-workspace-pending #editor { visibility: hidden; }
.topbar { grid-area: top; min-width: 0; height: var(--topbar); display: flex; align-items: center; gap: 7px; padding: 4px 8px; border-bottom: 1px solid var(--line); background: rgba(11,18,32,.96); z-index: 30; }
.brand-mark { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 700; font-size: 13px; }
.brand-mark span { max-width: 170px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.document-title { width: min(34vw, 420px); min-width: 100px; border: 0; border-left: 1px solid var(--line); background: transparent; outline: none; font-size: 15px; font-weight: 700; padding: 4px 10px; }
.document-title:focus { background: var(--panel); border-radius: 7px; }
.top-spacer { flex: 1; }
.view-tabs { display: flex; background: var(--panel); padding: 2px; border-radius: 8px; }
.tab, .ai-tab, .kind-button { border: 0; background: transparent; color: var(--muted); border-radius: 6px; padding: 4px 9px; }
.tab.active, .ai-tab.active, .kind-button.active { background: var(--panel-3); color: var(--text); }
.icon-button, .tool-button { min-width: 32px; height: 32px; border: 1px solid transparent; border-radius: 8px; background: transparent; display: inline-flex; align-items: center; justify-content: center; }
.icon-button:hover, .tool-button:hover { background: var(--panel-2); border-color: var(--line); }
.button { min-height: 32px; border-radius: 8px; border: 1px solid var(--line); padding: 5px 11px; background: var(--panel-2); }
.button.primary, .tool-button.primary { background: var(--accent-2); border-color: var(--accent); color: white; }
.button.quiet { background: transparent; }
.button.danger, .tool-button.danger { color: #ff9aa2; }
.compact-action { height: 31px; padding: 4px 10px; }
.full { width: 100%; }
.status, .canvas-status { color: var(--muted); font-size: 12px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #73809a; box-shadow: 0 0 0 3px rgba(115,128,154,.12); }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(95,211,154,.13); }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 0 3px rgba(239,106,115,.13); }
.status-dot.warning { background: #f2ba57; box-shadow: 0 0 0 3px rgba(242,186,87,.15); }
.sidebar { grid-area: side; min-width: 0; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; overflow: hidden; z-index: 20; }
.sidebar-header { height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 6px 9px 4px 12px; }
.search-box { margin: 2px 8px 7px; display: flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 8px; background: var(--panel-2); color: var(--muted); }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; }
.document-list { flex: 1; overflow: auto; padding: 0 5px 8px; }
.document-item { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; border: 0; border-radius: 8px; padding: 8px; background: transparent; }
.document-item:hover { background: var(--panel-2); }
.document-item.active { background: #243250; }
.document-item span { color: var(--muted); font-size: 11px; }
.sidebar-footer { padding: 7px; border-top: 1px solid var(--line); }
.workspace { grid-area: work; min-width: 0; min-height: 0; position: relative; overflow: hidden; }
.view { position: absolute; inset: 0; display: none; overflow: hidden; }
.view.active { display: block; }
#document-view { overflow: auto; }
.editor { max-width: 880px; margin: 0 auto; padding: 42px 58px 110px; min-height: 100%; }
.block { position: relative; padding: 4px 8px; margin: 1px 0; border-radius: 7px; border: 1px solid transparent; }
.block:hover, .block.selected { border-color: var(--line); background: rgba(255,255,255,.018); }
.block [contenteditable] { min-height: 1.35em; outline: 0; line-height: 1.55; }
.block-heading [contenteditable] { font-size: 25px; font-weight: 750; line-height: 1.25; }
.block-callout { background: rgba(109,140,255,.08); border-left: 3px solid var(--accent); padding: 9px 12px; }
.block-checklist { display: grid; grid-template-columns: 24px 1fr; align-items: start; }
.block-checklist input { margin-top: 5px; width: 17px; height: 17px; }
.floating-toolbar { position: absolute; z-index: 15; display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); background: rgba(17,26,43,.92); backdrop-filter: blur(10px); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.22); }
.editor-toolbar { top: 8px; left: 50%; transform: translateX(-50%); }
.toolbar-divider { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.append-block { display: block; margin: -90px auto 70px; border: 0; color: var(--muted); background: transparent; padding: 8px 14px; }
.canvas-stage { position: absolute; inset: 0; overflow: hidden; background: #0d1626; touch-action: none; outline: 0; }
.vector-canvas { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; touch-action: none; }
.grid-dot { fill: #253653; }
.arrow-marker { fill: context-stroke; }
.canvas-toolbar { left: 8px; top: 8px; max-width: calc(100% - 116px); overflow-x: auto; scrollbar-width: none; }
.canvas-toolbar::-webkit-scrollbar { display: none; }
.zoom-toolbar { right: 8px; bottom: 8px; }
.zoom-label { min-width: 50px; font-size: 11px; }
.canvas-status { position: absolute; left: 9px; bottom: 9px; padding: 5px 8px; border-radius: 7px; background: rgba(11,18,32,.74); pointer-events: none; }
.canvas-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); pointer-events: none; }
.canvas-empty strong { color: var(--text); font-size: 18px; }
.canvas-empty.hidden { display: none; }
.canvas-object { cursor: move; }
.canvas-object.generating { opacity: .72; animation: pulse 1.1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .45; } to { opacity: .9; } }
.selection-box { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-dasharray: 5 3; pointer-events: none; }
.resize-handle { fill: white; stroke: var(--accent-2); stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: nwse-resize; }
.resize-handle[data-handle="ne"], .resize-handle[data-handle="sw"] { cursor: nesw-resize; }
.rotation-handle { fill: var(--accent); stroke: white; vector-effect: non-scaling-stroke; cursor: grab; }
.canvas-inspector { position: absolute; top: 48px; right: 8px; width: 278px; max-height: calc(100% - 94px); overflow: auto; z-index: 18; border: 1px solid var(--line); border-radius: 12px; padding: 9px; background: rgba(17,26,43,.94); backdrop-filter: blur(12px); box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.inspector-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.inspector-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 6px; }
.inspector-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.canvas-inspector label, .settings-form label, .ai-section label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.canvas-inspector input, .canvas-inspector textarea, .settings-form input, .settings-form select, .ai-section input, .ai-section select, .ai-section textarea { width: 100%; min-height: 31px; border: 1px solid var(--line); border-radius: 7px; background: var(--bg); padding: 5px 7px; color: var(--text); }
.canvas-inspector textarea { resize: vertical; }
.inspector-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.media-properties { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.focus-exit { display: none; position: absolute; top: 8px; right: 8px; z-index: 30; }
.canvas-stage:fullscreen, body.canvas-focus .canvas-stage { background: #0d1626; }
.canvas-stage:fullscreen .focus-exit, body.canvas-focus .focus-exit { display: inline-flex; }
.canvas-stage:fullscreen .canvas-toolbar, body.canvas-focus .canvas-toolbar { right: 92px; max-width: calc(100% - 108px); }
body.canvas-focus .topbar, body.canvas-focus .sidebar { display: none; }
body.canvas-focus .app-shell { display: block; }
body.canvas-focus .workspace, body.canvas-focus #canvas-view { position: fixed; inset: 0; display: block; z-index: 100; }
.ai-panel { position: fixed; top: var(--topbar); right: 0; bottom: 0; width: min(380px, 100vw); z-index: 35; transform: translateX(102%); transition: transform .18s ease; border-left: 1px solid var(--line); background: var(--panel); padding: 10px; overflow: auto; box-shadow: -10px 0 30px rgba(0,0,0,.28); }
.ai-panel.open { transform: translateX(0); }
.panel-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.ai-tabs, .generation-kind { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 8px; padding: 3px; margin-bottom: 10px; }
.ai-section { display: none; }
.ai-section.active { display: flex; flex-direction: column; gap: 9px; }
.ai-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.ai-actions button { border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); padding: 6px; }
.ai-status { min-height: 25px; padding: 8px 0; color: var(--muted); font-size: 12px; }
.ai-result { border-top: 1px solid var(--line); padding-top: 9px; }
.proposal-heading, .proposal-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.proposal-explanation { margin: 8px 0; }
.proposal-preview { max-height: 260px; overflow: auto; padding: 8px; border-radius: 8px; background: var(--bg); white-space: pre-wrap; font-size: 12px; }
.compact-grid { grid-template-columns: 1fr 1fr; }
.bottom-nav { display: none; }
dialog { color: var(--text); width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 0; box-shadow: 0 20px 70px rgba(0,0,0,.55); }
dialog::backdrop { background: rgba(0,0,0,.58); }
.settings-form { padding: 14px; overflow: auto; }
.settings-form header { display: flex; justify-content: space-between; align-items: flex-start; }
.settings-form h2 { margin: 0; font-size: 19px; }
.settings-form p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 11px 0; }
.provider-settings, .privacy-note { margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.provider-settings[hidden] { display: none; }
.provider-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.security-warning { padding: 8px; border-left: 3px solid #d9a441; background: rgba(217,164,65,.08); }
.settings-form menu { display: flex; justify-content: flex-end; gap: 7px; margin: 12px 0 0; padding: 0; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 1000; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .18s ease; background: #f4f7ff; color: #121827; border-radius: 9px; padding: 8px 13px; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.toast.visible { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 920px) {
  :root { --sidebar: 220px; }
  .brand-mark span { display: none; }
  .editor { padding-inline: 34px; }
  .canvas-inspector { width: 248px; }
}
@media (max-width: 720px) {
  :root { --bottom: 48px; }
  .app-shell { grid-template-columns: 1fr; grid-template-areas: "top" "work"; }
  .sidebar { position: fixed; top: var(--topbar); bottom: var(--bottom); left: 0; width: min(86vw, 310px); transform: translateX(-103%); transition: transform .18s ease; box-shadow: 12px 0 30px rgba(0,0,0,.35); }
  .sidebar.open { transform: translateX(0); }
  .brand-mark { display: none; }
  .document-title { flex: 1; width: auto; }
  .topbar .status-dot, #export-button { display: none; }
  .editor { padding: 42px 16px 100px; }
  .bottom-nav { display: grid; position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottom); z-index: 32; grid-template-columns: repeat(4,1fr); border-top: 1px solid var(--line); background: var(--panel); }
  .bottom-nav button { border: 0; background: transparent; color: var(--muted); }
  .bottom-nav button.active { color: white; background: var(--panel-2); }
  .ai-panel { top: var(--topbar); bottom: var(--bottom); width: 100%; }
  .canvas-toolbar { left: 5px; top: 5px; right: 5px; max-width: none; }
  .canvas-inspector { top: auto; bottom: calc(var(--bottom) + 5px); left: 5px; right: 5px; width: auto; max-height: 45%; }
  .canvas-status { bottom: calc(var(--bottom) + 5px); }
  .zoom-toolbar { bottom: calc(var(--bottom) + 5px); }
  body.canvas-focus .bottom-nav { display: none; }
  body.canvas-focus .canvas-inspector { bottom: 5px; }
  body.canvas-focus .canvas-status, body.canvas-focus .zoom-toolbar { bottom: 5px; }
}
@media (max-width: 460px) {
  .view-tabs .tab { padding-inline: 6px; }
  .compact-action { padding-inline: 7px; }
  .settings-grid { grid-template-columns: 1fr; }
  .inspector-grid.four { grid-template-columns: repeat(2,1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }


/* ---------------- Fourth draft visual system ---------------- */
:root {
  --bg: #101216;
  --panel: #15181e;
  --panel-2: #1b1f27;
  --panel-3: #242a35;
  --line: #2b313d;
  --line-strong: #3a4352;
  --text: #f5f7fb;
  --muted: #9ba5b5;
  --accent: #8da2ff;
  --accent-2: #6478e8;
  --danger: #ff727d;
  --success: #58d39b;
  --topbar: 38px;
  --sidebar: 232px;
  accent-color: var(--accent);
}
body { background: var(--bg); }
.app-shell { transition: grid-template-columns .18s ease; }
body.sidebar-collapsed .app-shell { grid-template-columns: 0 minmax(0, 1fr); }
body.sidebar-collapsed .sidebar { opacity: 0; pointer-events: none; transform: translateX(-100%); }
.topbar {
  gap: 5px;
  padding: 3px 6px;
  background: rgba(16,18,22,.94);
  border-bottom-color: rgba(255,255,255,.08);
  backdrop-filter: blur(18px) saturate(1.25);
}
.brand-mark { gap: 6px; font-size: 12px; letter-spacing: -.01em; }
.brand-mark img { width: 20px; height: 20px; }
.document-title {
  border-left-color: rgba(255,255,255,.09);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.icon-button, .tool-button {
  min-width: 30px;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  transition: background .12s ease, border-color .12s ease, color .12s ease, transform .12s ease;
}
.icon-button svg, .tool-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.icon-button:active, .tool-button:active { transform: translateY(1px); }
.view-tabs { padding: 2px; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.055); }
.tab { min-width: 52px; padding: 3px 10px; font-size: 12px; }
.tab.active { background: #2a303b; box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.button { border-radius: 7px; }
.button.compact { min-height: 27px; padding: 3px 8px; font-size: 11px; }
.button.primary, .tool-button.primary {
  background: linear-gradient(180deg, #7288f4, #586bd4);
  border-color: #8498fa;
  box-shadow: 0 3px 10px rgba(73,91,198,.22);
}
.sidebar {
  background: #13161b;
  border-right-color: rgba(255,255,255,.075);
  transition: opacity .16s ease, transform .18s ease;
}
.sidebar-header { height: 39px; padding: 5px 6px 3px 10px; }
.sidebar-header > div:first-child { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.sidebar-header-actions { display: flex; gap: 2px; }
.count-badge {
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.055);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.search-box {
  min-height: 31px;
  margin: 1px 7px 6px;
  padding: 5px 8px;
  border: 1px solid transparent;
  background: #1a1e25;
}
.search-box:focus-within { border-color: #46516a; background: #1d222b; }
.document-list { padding: 0 5px 7px; }
.document-row {
  display: grid;
  grid-template-columns: minmax(0,1fr) 28px;
  align-items: center;
  min-height: 46px;
  border-radius: 8px;
  margin: 1px 0;
}
.document-row:hover { background: #1c2028; }
.document-row.active { background: #242b3b; box-shadow: inset 2px 0 var(--accent); }
.document-item {
  min-width: 0;
  min-height: 44px;
  padding: 6px 8px;
  gap: 1px;
  border-radius: 8px;
}
.document-item:hover, .document-item.active { background: transparent; }
.document-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.document-item span { font-size: 10px; }
.document-delete {
  opacity: 0;
  width: 26px;
  min-width: 26px;
  height: 26px;
  color: var(--muted);
}
.document-row:hover .document-delete, .document-row:focus-within .document-delete { opacity: 1; }
.document-delete:hover { color: #ff98a1; background: rgba(255,114,125,.1); border-color: rgba(255,114,125,.22); }
.sidebar-footer { border-top-color: rgba(255,255,255,.06); }
.floating-toolbar {
  gap: 2px;
  padding: 3px;
  background: rgba(22,25,31,.88);
  border-color: rgba(255,255,255,.1);
  box-shadow: 0 8px 30px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.025);
  backdrop-filter: blur(18px) saturate(1.2);
}
.canvas-stage, .canvas-stage:fullscreen, body.canvas-focus .canvas-stage { background: #111722; }
.grid-dot { fill: #263044; opacity: .72; }
.canvas-toolbar {
  left: 8px;
  top: 8px;
  max-width: calc(100% - 112px);
  overflow: visible;
  transition: width .15s ease;
}
.canvas-toolbar .toolbar-content { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.canvas-toolbar .toolbar-content::-webkit-scrollbar { display: none; }
.canvas-toolbar .tool-group { display: flex; align-items: center; gap: 1px; }
.canvas-toolbar .toolbar-pin { flex: 0 0 auto; }
.canvas-toolbar .toolbar-pin svg { transition: transform .16s ease; }
.canvas-toolbar.collapsed .toolbar-content { display: none; }
.canvas-toolbar.collapsed .toolbar-pin svg { transform: rotate(180deg); }
.canvas-toolbar.collapsed { max-width: none; width: 38px; }
.tool-button.active { color: #fff; background: #303849; border-color: #4a5872; }
.tool-button.text-tool { width: auto; padding-inline: 7px; gap: 5px; }
.tool-button.text-tool span { font-size: 11px; }
.toolbar-divider { height: 18px; background: rgba(255,255,255,.09); margin-inline: 3px; }
.zoom-toolbar { border-radius: 9px; }
.canvas-status {
  left: 8px;
  bottom: 8px;
  padding: 4px 7px;
  background: rgba(13,16,21,.72);
  border: 1px solid rgba(255,255,255,.06);
  font-size: 10px;
}
.canvas-inspector {
  top: 48px;
  right: 8px;
  width: 304px;
  max-height: calc(100% - 92px);
  border-radius: 10px;
  padding: 9px;
  background: rgba(20,23,29,.94);
  border-color: rgba(255,255,255,.1);
  box-shadow: 0 16px 44px rgba(0,0,0,.38);
}
.inspector-header { min-height: 28px; margin-bottom: 7px; }
.inspector-header strong { font-size: 12px; letter-spacing: .01em; }
.inspector-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 25px;
  margin-bottom: 6px;
  color: #cbd2df;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.canvas-inspector input, .canvas-inspector textarea, .canvas-inspector select {
  min-height: 29px;
  border-radius: 6px;
  border-color: rgba(255,255,255,.095);
  background: #11141a;
}
.canvas-inspector input:focus, .canvas-inspector textarea:focus, .canvas-inspector select:focus {
  outline: 1px solid #6678d8;
  border-color: #6678d8;
}
.color-grid { grid-template-columns: 1fr 1fr; }
.color-control { display: grid; grid-template-columns: 31px minmax(0,1fr); gap: 5px; }
.color-control input[type="color"] { padding: 2px; min-width: 31px; width: 31px; }
.color-control input[type="text"] { min-width: 0; text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.paint-target { display: flex; padding: 2px; border-radius: 6px; background: #11141a; }
.paint-target button { border: 0; border-radius: 4px; background: transparent; color: var(--muted); padding: 3px 7px; font-size: 10px; }
.paint-target button.active { color: white; background: #303849; }
.palette-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px; margin-top: 7px; }
.palette-row select { min-width: 0; }
.palette-swatches {
  display: grid;
  grid-template-columns: repeat(10, minmax(18px,1fr));
  gap: 4px;
  margin-top: 7px;
}
.palette-swatch {
  aspect-ratio: 1;
  min-width: 0;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}
.palette-swatch:hover { outline: 2px solid rgba(255,255,255,.6); outline-offset: 1px; }
.rounding-control { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; align-items: end; }
.rounding-control label { min-width: 0; }
.rounding-control output { float: right; color: var(--text); }
.node-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.node-mode-controls { margin-top: 7px; padding: 7px; border-radius: 7px; background: #11141a; }
.node-mode-controls p { margin: 5px 0 0; line-height: 1.35; }
.path-node {
  fill: #fff;
  stroke: #6178ee;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  cursor: move;
}
.path-node.selected { fill: #8da2ff; }
.path-handle {
  fill: #111722;
  stroke: #f3a45f;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  cursor: crosshair;
}
.path-handle-line {
  stroke: #f3a45f;
  stroke-width: 1;
  stroke-dasharray: 3 2;
  opacity: .8;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.path-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  vector-effect: non-scaling-stroke;
  cursor: crosshair;
}
body.node-editing .canvas-object { cursor: default; }
body.adding-node .canvas-stage { cursor: copy; }
.selection-box { stroke: #90a4ff; }
.resize-handle { fill: #f8faff; stroke: #657cf0; }
.focus-exit {
  min-height: 30px;
  padding: 4px 10px;
  background: rgba(20,23,29,.9);
}
body.canvas-focus .canvas-inspector { top: 48px; }
body.canvas-focus.ui-hidden .canvas-toolbar,
body.canvas-focus.ui-hidden .zoom-toolbar,
body.canvas-focus.ui-hidden .canvas-inspector,
body.canvas-focus.ui-hidden .canvas-status { opacity: 0; pointer-events: none; }
body.canvas-focus.ui-hidden .focus-exit { opacity: .42; }
body.canvas-focus.ui-hidden .focus-exit:hover { opacity: 1; }

@media (max-width: 720px) {
  body.sidebar-collapsed .sidebar { transform: translateX(-103%); opacity: 1; }
  .sidebar-close { display: inline-flex; }
  .canvas-toolbar { right: auto; max-width: calc(100% - 16px); }
  .canvas-toolbar:not(.collapsed) { width: calc(100% - 16px); }
  .canvas-toolbar .toolbar-content { overflow-x: auto; }
  .canvas-inspector {
    bottom: calc(var(--bottom) + 5px);
    max-height: min(48%, 430px);
    border-radius: 12px 12px 0 0;
  }
  .palette-swatches { grid-template-columns: repeat(12, minmax(18px,1fr)); }
}
@media (min-width: 721px) {
  .sidebar-close { display: inline-flex; }
}

@media (hover: none), (pointer: coarse) { .document-delete { opacity: 1; } }


/* Fifth draft: modular surfaces and bidirectional labels */
.plugin-state { color: var(--muted); font-size: 11px; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.block { padding-right: 76px; }
.block-label { position: absolute; right: 6px; top: 5px; max-width: 112px; border: 1px solid transparent; border-radius: 999px; padding: 2px 7px; background: transparent; color: var(--muted); font-size: 11px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transition: opacity .15s ease, border-color .15s ease, background .15s ease; }
.block:hover .block-label, .block.selected .block-label, .block-label.active { opacity: 1; }
.block-label:hover, .block-label.active { color: #cdd6ff; border-color: rgba(100,120,232,.45); background: rgba(100,120,232,.12); }
.block-linked { border-left: 2px solid rgba(100,120,232,.7); background: rgba(100,120,232,.055); padding-top: 22px; }
.linked-surface-badge { position: absolute; left: 9px; top: 4px; color: #9fb0ff; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.label-tool { font-weight: 800; color: #aebcff; }
.object-label-row { display: grid; gap: 5px; margin-bottom: 10px; }
.object-label-row small { color: var(--muted); font-size: 10px; }
.label-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(720px, calc(100dvh - 32px));
  border-color: rgba(151, 166, 200, .26);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(20,27,40,.985), rgba(15,21,32,.985));
  box-shadow: 0 30px 100px rgba(0,0,0,.58), 0 0 0 1px rgba(255,255,255,.015) inset;
  overflow: hidden;
}
.label-dialog::backdrop { background: rgba(3,7,14,.72); backdrop-filter: blur(4px); }
.label-form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 0; }
.label-form-header { display: grid; grid-template-columns: 42px minmax(0,1fr) 36px; gap: 14px; align-items: start; padding: 28px 30px 20px; }
.label-dialog-symbol { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #a78bfa; background: linear-gradient(145deg, rgba(139,92,246,.18), rgba(99,102,241,.08)); border: 1px solid rgba(167,139,250,.22); }
.label-dialog-symbol svg, .label-section-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.label-dialog-heading { min-width: 0; }
.label-form h2 { margin: 1px 0 7px; font-size: 25px; line-height: 1.15; letter-spacing: -.02em; }
.label-form-header p { max-width: 500px; margin: 0; color: #b4bfd2; font-size: 14px; line-height: 1.55; }
.label-dialog-close { width: 34px; min-width: 34px; height: 34px; color: #aeb8ca; font-size: 24px; line-height: 1; }
.label-form-body { min-height: 0; overflow: auto; padding: 2px 30px 26px; scrollbar-width: thin; }
.label-form-section { display: grid; gap: 14px; padding: 13px 0; }
.label-section-heading { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 12px; align-items: start; }
.label-section-icon { width: 32px; height: 32px; display: grid; place-items: center; color: #9d8cff; }
.label-section-icon svg { width: 21px; height: 21px; }
.label-section-heading h3 { margin: 1px 0 3px; color: var(--text); font-size: 15px; line-height: 1.3; }
.label-section-heading p { margin: 0; color: #aab5c8; font-size: 12px; line-height: 1.45; }
.label-field { display: grid; gap: 7px; margin-left: 46px; }
.label-field input { width: 100%; min-height: 46px; border: 1px solid rgba(143,158,190,.30); border-radius: 11px; outline: none; background: rgba(6,11,20,.48); color: var(--text); padding: 0 14px; font-size: 14px; transition: border-color .14s ease, box-shadow .14s ease, background .14s ease; }
.label-field input:hover { border-color: rgba(157,140,255,.46); background: rgba(8,14,25,.68); }
.label-field input:focus { border-color: rgba(157,140,255,.88); box-shadow: 0 0 0 3px rgba(124,92,255,.14); background: rgba(8,14,25,.82); }
.label-field small { color: #8693a9; font-size: 11px; line-height: 1.4; }
.label-section-divider { height: 1px; margin: 7px 0; background: linear-gradient(90deg, transparent, rgba(148,163,184,.18) 8%, rgba(148,163,184,.18) 92%, transparent); }
.label-slide-picker { position: relative; margin-left: 46px; }
.label-slide-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; clip-path: inset(50%); }
.label-slide-trigger { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid rgba(143,158,190,.30); border-radius: 11px; outline: none; background: rgba(6,11,20,.48); color: var(--text); padding: 0 14px; text-align: left; font-size: 14px; transition: border-color .14s ease, box-shadow .14s ease, background .14s ease; }
.label-slide-trigger:hover { border-color: rgba(157,140,255,.48); background: rgba(8,14,25,.68); }
.label-slide-trigger:focus-visible, .label-slide-trigger[aria-expanded="true"] { border-color: rgba(157,140,255,.9); box-shadow: 0 0 0 3px rgba(124,92,255,.14); background: rgba(8,14,25,.82); }
.label-slide-trigger svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: #aeb8ca; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .14s ease; }
.label-slide-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }
.label-slide-menu { position: relative; z-index: 2; display: grid; gap: 3px; max-height: min(250px, 38vh); overflow: auto; margin-top: 7px; padding: 7px; border: 1px solid rgba(143,158,190,.28); border-radius: 12px; background: rgba(13,19,30,.985); box-shadow: 0 20px 60px rgba(0,0,0,.46); }
.label-slide-menu[hidden] { display: none; }
.label-slide-option { position: relative; min-height: 42px; width: 100%; display: flex; align-items: center; border: 0; border-radius: 8px; background: transparent; color: #dfe5f1; padding: 8px 38px 8px 12px; text-align: left; font-size: 13px; }
.label-slide-option:hover, .label-slide-option:focus-visible { outline: none; background: rgba(124,92,255,.11); }
.label-slide-option[aria-selected="true"] { color: #f4f1ff; background: linear-gradient(90deg, rgba(124,92,255,.22), rgba(99,102,241,.13)); }
.label-slide-option[aria-selected="true"]::after { content: "✓"; position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: #b5a5ff; font-size: 15px; }
.block.has-slide-note .block-label { color: #c7d2ff; border-color: rgba(100,120,232,.32); background: rgba(100,120,232,.09); opacity: 1; }
.label-form-footer { display: grid; grid-template-columns: auto 1fr auto minmax(110px, auto); gap: 10px; align-items: center; padding: 18px 30px 22px; border-top: 1px solid rgba(148,163,184,.14); background: rgba(5,9,17,.22); }
.label-form-footer .button { min-height: 42px; padding: 7px 18px; border-radius: 10px; }
.label-clear-button { color: #d99ca5; }
.label-save-button { min-width: 116px; border-color: rgba(147,125,255,.88) !important; background: linear-gradient(135deg, #7656f5, #6547e8) !important; box-shadow: 0 8px 24px rgba(99,71,232,.22); }
.label-save-button:hover { filter: brightness(1.06); }
@media (max-width: 620px) {
  .label-dialog { width: calc(100vw - 18px); max-height: calc(100dvh - 18px); border-radius: 16px; }
  .label-form-header { grid-template-columns: 36px minmax(0,1fr) 32px; gap: 10px; padding: 20px 18px 14px; }
  .label-dialog-symbol { width: 36px; height: 36px; }
  .label-form h2 { font-size: 21px; }
  .label-form-body { padding: 0 18px 18px; }
  .label-field, .label-slide-picker { margin-left: 0; }
  .label-form-footer { padding: 14px 18px 16px; grid-template-columns: auto 1fr auto auto; }
  .label-form-footer .button { min-height: 40px; padding-inline: 12px; }
}
.plugin-settings { display: grid; gap: 10px; }
.plugin-settings .section-heading { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.plugin-settings small { color: var(--muted); font-weight: 400; }
.plugin-list { display: grid; gap: 6px; }
.plugin-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.018); }
.plugin-row span:first-child { display: grid; gap: 2px; }
.plugin-row small { color: var(--muted); font-size: 10px; }
.plugin-badge { color: var(--muted); font-size: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; }
.plugin-badge.active { color: #8de0bc; border-color: rgba(88,211,155,.35); background: rgba(88,211,155,.08); }
@media (max-width: 720px) {
  .plugin-state { display: none; }
  .block { padding-right: 62px; }
  .block-label { opacity: 1; max-width: 88px; }
}

/* ---------------- Sixth draft shared workspace and history ---------------- */
.workspace-switcher {
  width: clamp(112px, 16vw, 210px);
  height: 29px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  padding: 3px 24px 3px 8px;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
}
.sync-state {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
}
.sync-state.saved { color: var(--success); }
.sync-state.saving { color: #f1c75b; }
.sync-state.conflict, .sync-state.error { color: var(--danger); }
.user-chip {
  height: 30px;
  max-width: 132px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  padding: 2px 8px 2px 3px;
  font-size: 11px;
  font-weight: 650;
}
.user-chip:hover { border-color: var(--line-strong); background: var(--panel-3); }
#user-avatar {
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
  color: white;
  font-size: 10px;
}
#user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-dialog { width: min(460px, calc(100vw - 24px)); }
.identity-dialog menu { justify-content: stretch; }
.identity-dialog menu .button { width: 100%; }
.workspace-dialog { width: min(720px, calc(100vw - 24px)); }
.snapshots-dialog { width: min(680px, calc(100vw - 24px)); }
.workspace-management, .snapshot-management { max-height: min(760px, calc(100dvh - 24px)); }
.management-section {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.inline-management {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: end;
  margin-top: 8px;
}
#member-add-row { grid-template-columns: minmax(0, 1fr) 120px auto; }
.management-section details { margin-top: 10px; color: var(--muted); font-size: 12px; }
.management-section summary { cursor: pointer; user-select: none; }
.member-list { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
.member-row strong, .member-row small { display: block; }
.member-row small { color: var(--muted); font-size: 10px; }
.role-badge, .snapshot-tier {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  color: var(--muted);
  font-size: 10px;
  text-transform: capitalize;
}
.snapshot-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 11px;
}
.snapshot-summary > :first-child { color: var(--text); font-weight: 700; }
.snapshot-list { display: flex; flex-direction: column; gap: 5px; min-height: 140px; max-height: 52vh; overflow: auto; }
.snapshot-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}
.snapshot-row strong, .snapshot-row small { display: block; }
.snapshot-row small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.snapshot-empty { padding: 26px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 9px; }
.readonly-banner {
  position: absolute;
  left: 50%;
  top: 8px;
  z-index: 26;
  transform: translateX(-50%);
  border: 1px solid rgba(241,199,91,.38);
  border-radius: 999px;
  background: rgba(43,35,15,.94);
  padding: 5px 10px;
  color: #f1c75b;
  font-size: 11px;
  pointer-events: none;
}
body.workspace-readonly [contenteditable="true"] { cursor: default; }
body.workspace-readonly .editor-toolbar,
body.workspace-readonly .canvas-toolbar .toolbar-content,
body.workspace-readonly #append-block { opacity: .45; pointer-events: none; }
@media (max-width: 1080px) {
  #brand-name, .plugin-state { display: none; }
  .workspace-switcher { width: 132px; }
  .user-chip { max-width: 92px; }
}
@media (max-width: 720px) {
  .workspace-switcher { width: 104px; min-width: 0; }
  .sync-state, #snapshot-button, #user-name { display: none; }
  .user-chip { width: 30px; padding: 2px; justify-content: center; }
  .member-row, .snapshot-row { grid-template-columns: minmax(0,1fr) auto; }
  .member-row .button, .snapshot-row .snapshot-tier { grid-column: 2; }
  #member-add-row { grid-template-columns: 1fr 1fr; }
  #member-add-row .button { grid-column: 1 / -1; }
}

/* Realtime collaboration */
.collaboration-presence { display: flex; align-items: center; min-width: 0; padding-left: 4px; }
.presence-avatar, .presence-more {
  width: 24px; height: 24px; margin-left: -5px; border-radius: 999px; display: inline-grid; place-items: center;
  border: 2px solid var(--surface-1, #111318); background: #5266cc; color: #fff; font-size: 10px; font-weight: 800;
  box-shadow: 0 1px 5px rgba(0,0,0,.25);
}
.presence-avatar:first-child { margin-left: 0; }
.presence-avatar.canvas { background: #188c7f; }
.presence-avatar { border: 2px solid transparent; cursor: pointer; font: inherit; }
.presence-avatar.following { border-color: var(--accent, #6ea8ff); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #6ea8ff) 24%, transparent); }
.remote-presence-viewport, .remote-selection-box { fill: none; vector-effect: non-scaling-stroke; pointer-events: none; }
.remote-presence-viewport { stroke-width: 1.5; stroke-dasharray: 8 6; opacity: .58; }
.remote-selection-box { stroke-width: 2; stroke-dasharray: 5 4; opacity: .82; }
.remote-presence-label, .remote-presence-cursor { pointer-events: none; user-select: none; }
.remote-presence-label { font-weight: 700; paint-order: stroke; stroke: var(--panel, #111827); stroke-width: 3px; stroke-linejoin: round; }
.remote-presence-cursor-glyph { stroke-width: 1.5; stroke-linejoin: round; }
.remote-presence-cursor-badge text { font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .remote-presence-cursor { transition: none !important; } }
.presence-more { background: #303746; color: #cfd6e6; }
.sync-state.live { color: var(--success); }
.sync-state.reconnecting { color: #f1c75b; }
@media (max-width: 850px) { .collaboration-presence { display: none; } }

/* Realtime presentation plugin */
.presentation-button.active { color: var(--accent, #8da2ff); background: rgba(100,120,232,.14); }
.presentation-button.presenting { box-shadow: inset 0 0 0 1px rgba(255,114,125,.6); }
.presentation-panel {
  position: fixed; top: calc(var(--topbar) + 8px); right: 8px; z-index: 80;
  width: min(360px, calc(100vw - 16px)); border: 1px solid var(--line);
  border-radius: 14px; background: rgba(17,23,34,.98); box-shadow: 0 18px 60px rgba(0,0,0,.42);
  color: var(--text); overflow: hidden;
}
.presentation-panel[hidden], .presentation-hud[hidden] { display: none !important; }
.presentation-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 9px; border-bottom: 1px solid var(--line); }
.presentation-panel > header > div { display: grid; gap: 2px; }
.presentation-panel > header small { color: var(--muted); font-size: 11px; }
.presentation-panel-body { display: grid; gap: 12px; padding: 12px; }
.presentation-panel-body p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.presentation-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.presentation-toggle, .presentation-zoom { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.presentation-toggle { grid-template-columns: auto 1fr; }
.presentation-zoom input[type="range"] { grid-column: 1 / -1; width: 100%; }
.presentation-help { color: var(--muted); line-height: 1.45; }
.presentation-hud {
  position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 120; display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 10px;
  border: 1px solid rgba(141,162,255,.42); border-radius: 999px; background: rgba(11,18,32,.94);
  box-shadow: 0 12px 36px rgba(0,0,0,.35); backdrop-filter: blur(16px); font-size: 12px;
}
.presentation-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #ff727d; box-shadow: 0 0 0 4px rgba(255,114,125,.14); }
body.presentation-following .workspace { cursor: default; }
body.presentation-following #document-view,
body.presentation-following #canvas-stage { user-select: none; }
body.presentation-following .editor-toolbar,
body.presentation-following .canvas-toolbar,
body.presentation-following .canvas-inspector,
body.presentation-following .zoom-toolbar { pointer-events: none; opacity: .18; }
body.presentation-clean .topbar,
body.presentation-clean .sidebar,
body.presentation-clean .mobile-nav { display: none !important; }
body.presentation-clean .app-shell { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); grid-template-areas: "work"; }
body.presentation-clean .workspace { grid-area: work; }
body.presentation-clean #document-view { padding-top: 0; }
body.presentation-clean .editor-toolbar { display: none; }
body.presentation-clean .editor { padding-top: 26px; }
body.presentation-clean .presentation-panel { top: 8px; }
@media (max-width: 720px) {
  .presentation-panel { top: calc(var(--topbar) + 5px); right: 5px; width: calc(100vw - 10px); }
  .presentation-hud { max-width: calc(100vw - 16px); white-space: nowrap; }
}
body.presentation-following #editor,
body.presentation-following #vector-canvas,
body.presentation-following #document-title,
body.presentation-following #document-list { pointer-events: none; }


/* Canvas groups and Prezi-style slide navigation */
.slide-groups-button.active { color: var(--accent); background: rgba(100,120,232,.14); }
.slide-groups-panel {
  position: fixed;
  top: calc(var(--topbar) + 8px);
  right: 8px;
  z-index: 79;
  width: min(350px, calc(100vw - 16px));
  max-height: calc(100dvh - var(--topbar) - 16px);
  display: grid;
  grid-template-rows: auto auto minmax(0,1fr) auto auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(17,23,34,.98);
  color: var(--text);
  box-shadow: 0 18px 60px rgba(0,0,0,.42);
  backdrop-filter: blur(18px);
}
.slide-groups-panel[hidden] { display: none !important; }
.slide-groups-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px 9px;
  border-bottom: 1px solid var(--line);
}
.slide-groups-header > div { display: grid; gap: 2px; }
.slide-groups-header small,
.slide-group-editor small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.slide-groups-actions {
  display: flex;
  gap: 7px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
.slide-group-list { overflow: auto; padding: 6px; min-height: 60px; }
.slide-group-row {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.slide-group-row:hover { background: var(--panel-2); }
.slide-group-row.active { border-color: rgba(141,162,255,.52); background: rgba(100,120,232,.13); }
.slide-group-row-main { min-width: 0; display: grid; flex: 1; gap: 2px; }
.slide-group-row-main strong,
.slide-group-row-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-group-row-main small { color: var(--muted); font-size: 10px; }
.slide-number {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(100,120,232,.2);
  color: #dce5ff;
  font-size: 11px;
  font-weight: 800;
}
.slide-group-editor {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
  background: rgba(9,13,21,.32);
  overflow: auto;
}
.slide-group-editor[hidden] { display: none !important; }
.slide-group-editor > label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.slide-group-editor input[type="text"] {
  min-width: 0;
  width: 100%;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  padding: 0 8px;
}
.slide-group-editor input[type="range"] { width: 100%; }
.slide-toggle { grid-template-columns: auto 1fr !important; align-items: center; }
.slide-group-membership,
.slide-group-order { display: flex; flex-wrap: wrap; gap: 6px; }
.slide-groups-empty { padding: 14px; color: var(--muted); font-size: 12px; text-align: center; }
.canvas-slide-frame { pointer-events: none; opacity: .62; }
.canvas-slide-frame rect {
  fill: rgba(100,120,232,.025);
  stroke: rgba(141,162,255,.36);
  stroke-width: 1.25;
  stroke-dasharray: 7 6;
}
.canvas-slide-frame text {
  fill: rgba(205,214,255,.78);
  stroke: none;
  font: 700 12px system-ui, sans-serif;
  letter-spacing: .02em;
}
.canvas-slide-frame.is-slide rect { stroke: rgba(88,211,155,.58); stroke-dasharray: none; }
.canvas-slide-frame.is-slide text { fill: rgba(152,241,202,.92); }
.canvas-slide-frame.selected { opacity: 1; }
.canvas-slide-frame.selected rect { stroke-width: 2; }
body.presentation-presenting .canvas-slide-frame,
body.presentation-following .canvas-slide-frame { opacity: 0; }

.slide-navigation-controller {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 130;
  display: none;
  grid-template-columns: 34px 48px 34px;
  grid-template-rows: 30px 36px 30px;
  grid-template-areas:
    ". up ."
    "left count right"
    ". down .";
  align-items: center;
  justify-items: center;
  gap: 2px;
  padding: 5px;
  border: 1px solid rgba(141,162,255,.38);
  border-radius: 15px;
  background: rgba(8,13,23,.9);
  box-shadow: 0 12px 34px rgba(0,0,0,.38);
  backdrop-filter: blur(16px);
}
.slide-navigation-controller.active { display: grid; }
.slide-navigation-controller button {
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #e8edff;
  font-size: 24px;
  line-height: 1;
}
.slide-navigation-controller button:hover,
.slide-navigation-controller button:focus-visible { background: rgba(141,162,255,.18); outline: none; }
.slide-navigation-controller button:disabled { opacity: .3; }
.slide-navigation-controller [data-slide-direction="up"] { grid-area: up; }
.slide-navigation-controller [data-slide-direction="left"] { grid-area: left; }
.slide-navigation-controller [data-slide-direction="right"] { grid-area: right; }
.slide-navigation-controller [data-slide-direction="down"] { grid-area: down; }
.slide-navigation-controller [data-slide-counter] {
  grid-area: count;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
body.presentation-clean .slide-navigation-controller { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); }
body.presentation-following .slide-navigation-controller { display: none !important; }

@media (max-width: 720px) {
  .slide-groups-panel {
    top: calc(var(--topbar) + 5px);
    right: 5px;
    width: calc(100vw - 10px);
    max-height: calc(100dvh - var(--topbar) - var(--bottom) - 10px);
  }
  .slide-navigation-controller {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    transform: scale(.92);
    transform-origin: bottom right;
  }
}


/* Sandboxed Canvas embeds */
.canvas-object-embed { cursor: move; }
.canvas-embed-shell {
  position: relative;
  display: grid;
  grid-template-rows: 30px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #43506a;
  border-radius: 11px;
  background: #0a1020;
  color: #e8eefc;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .28);
  font: 12px/1.3 Inter, ui-sans-serif, system-ui, sans-serif;
}
.canvas-embed-shell.is-selected { border-color: #86a0ff; box-shadow: 0 0 0 1px rgba(134,160,255,.55), 0 14px 38px rgba(0,0,0,.32); }
.canvas-embed-shell.is-interacting { border-color: #5fd39a; box-shadow: 0 0 0 1px rgba(95,211,154,.45), 0 14px 38px rgba(0,0,0,.32); }
.canvas-embed-header {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 3px 5px 3px 8px;
  border-bottom: 1px solid #33415e;
  background: linear-gradient(180deg, #1a2540, #111a2d);
  user-select: none;
}
.canvas-embed-indicator { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #7d8aa5; }
.is-interacting .canvas-embed-indicator { background: #5fd39a; box-shadow: 0 0 0 3px rgba(95,211,154,.12); }
.canvas-embed-header strong { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
.canvas-embed-kind { padding: 2px 5px; border-radius: 5px; background: #253250; color: #aebce0; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.canvas-embed-header button {
  height: 22px;
  padding: 0 7px;
  border: 1px solid #3c4b69;
  border-radius: 5px;
  background: #18233a;
  color: #dbe5fb;
  font-size: 10px;
  font-weight: 700;
}
.canvas-embed-header button:hover { border-color: #7890e8; background: #243353; }
.canvas-embed-body { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #fff; }
.canvas-embed-body iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.canvas-embed-shield {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 12px;
  background: linear-gradient(180deg, transparent 60%, rgba(5,9,20,.72));
  color: #dce5ff;
  cursor: move;
}
.canvas-embed-shield span {
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(10,16,32,.78);
  font-size: 10px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
}
.canvas-embed-shell:hover .canvas-embed-shield span, .canvas-embed-shell.is-selected .canvas-embed-shield span { opacity: 1; transform: none; }
.embed-inspector-section { gap: 8px; }
.embed-sandbox-badge { padding: 2px 6px; border-radius: 999px; background: rgba(95,211,154,.12); color: #82e5b3; font-size: 10px; font-weight: 750; }
.embed-inspector-summary { display: grid; gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); }
.embed-inspector-summary small { color: var(--muted); }
.embed-inspector-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.embed-editor-dialog {
  width: min(1180px, calc(100vw - 24px));
  height: min(820px, calc(100dvh - 24px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #0c1424;
  color: var(--text);
  box-shadow: 0 32px 100px rgba(0,0,0,.55);
}
.embed-editor-dialog::backdrop { background: rgba(2,6,16,.76); backdrop-filter: blur(4px); }
.embed-editor-form { height: 100%; display: grid; grid-template-rows: auto auto auto minmax(0,1fr) auto auto auto; gap: 0; overflow: hidden; }
.embed-editor-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 16px 11px; border-bottom: 1px solid var(--line); }
.embed-editor-header h2 { margin: 0 0 3px; font-size: 17px; }
.embed-editor-header p { margin: 0; max-width: 760px; color: var(--muted); font-size: 12px; }
.embed-editor-options {
  display: grid;
  grid-template-columns: minmax(180px,1fr) minmax(220px,1fr) auto auto;
  align-items: end;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #101a2c;
}
.embed-editor-options label, .embed-url-row { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 650; }
.embed-editor-options input[type="text"], .embed-editor-options select, .embed-url-row input {
  height: 32px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  padding: 5px 8px;
  color: var(--text);
}
.embed-checkbox { display: flex !important; align-items: center; gap: 7px !important; min-height: 32px; white-space: nowrap; }
.embed-url-row { padding: 9px 14px; border-bottom: 1px solid var(--line); background: #101a2c; }
.embed-editor-workspace { min-height: 0; display: grid; grid-template-columns: minmax(340px, .9fr) minmax(360px, 1.1fr); gap: 1px; background: var(--line); }
.embed-code-pane, .embed-preview-pane { min-width: 0; min-height: 0; background: #0b1220; }
.embed-code-pane { display: grid; grid-template-rows: 38px minmax(0, 1fr); }
.embed-code-tabs { display: flex; align-items: end; gap: 2px; padding: 5px 8px 0; border-bottom: 1px solid var(--line); background: #111a2b; }
.embed-code-tabs button { height: 32px; padding: 0 12px; border: 0; border-radius: 7px 7px 0 0; background: transparent; color: var(--muted); }
.embed-code-tabs button.active { background: #0b1220; color: var(--text); box-shadow: 0 -1px 0 var(--line), 1px 0 0 var(--line), -1px 0 0 var(--line); }
.embed-code-pane textarea {
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  border: 0;
  outline: 0;
  background: #080e19;
  color: #d9e4fa;
  padding: 14px 16px 42px;
  font: 12px/1.55 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  tab-size: 2;
}
.embed-preview-pane { display: grid; grid-template-rows: 38px minmax(0,1fr); }
.embed-preview-pane > header { display: flex; align-items: center; justify-content: space-between; padding: 0 11px; border-bottom: 1px solid var(--line); background: #111a2b; font-size: 11px; }
.embed-preview-pane > header span { color: #82e5b3; }
.embed-preview-pane iframe { width: 100%; height: 100%; border: 0; background: white; }
.embed-security-note { display: flex; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.embed-security-note strong { color: #82e5b3; white-space: nowrap; }
.embed-security-note code { color: #c7d5f5; }
.embed-editor-error { min-height: 0; margin: 0; padding: 0 14px; color: #ff9aa2; font-size: 11px; }
.embed-editor-error:not(:empty) { min-height: 31px; padding-top: 8px; border-top: 1px solid rgba(239,106,115,.2); }
.embed-editor-form > footer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); background: #101a2c; }

@media (max-width: 820px) {
  .embed-editor-dialog { width: 100vw; height: 100dvh; max-width: none; max-height: none; border: 0; border-radius: 0; }
  .embed-editor-options { grid-template-columns: 1fr 1fr; }
  .embed-editor-workspace { grid-template-columns: 1fr; grid-template-rows: minmax(240px,.9fr) minmax(240px,1.1fr); overflow: auto; }
  .embed-security-note { display: none; }
}

/* ---------------- 0.11.3 document navigation ---------------- */
.document-list { scroll-behavior: smooth; contain: layout paint; }
.document-section-label {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 7px 8px 4px;
  background: linear-gradient(180deg, #13161b 72%, rgba(19,22,27,0));
  color: #7f8999;
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .11em;
  text-transform: uppercase;
  pointer-events: none;
}
.document-list-empty { padding: 18px 10px; color: var(--muted); font-size: 11px; text-align: center; }
.document-row {
  grid-template-columns: 16px minmax(0, 1fr) auto;
  min-height: 46px;
  overflow: hidden;
  isolation: isolate;
  transition: background-color .13s ease, box-shadow .13s ease, opacity .13s ease;
}
.document-row::before {
  content: '';
  position: absolute;
  inset: 1px;
  z-index: -1;
  border-radius: 7px;
  opacity: 0;
  background: linear-gradient(90deg, rgba(141,162,255,.10), transparent 70%);
  transition: opacity .14s ease;
}
.document-row.active::before { opacity: 1; }
.document-row.dragging { opacity: .42; }
.document-row.drop-target { box-shadow: inset 0 2px var(--accent); }
.document-row.drop-after { box-shadow: inset 0 -2px var(--accent); }
.document-drag {
  width: 16px;
  height: 34px;
  padding: 0;
  border: 0;
  color: #697384;
  background: transparent;
  cursor: grab;
}
.document-drag:active { cursor: grabbing; }
.document-drag svg { width: 14px; height: 18px; fill: currentColor; }
.document-drag[hidden] { visibility: hidden; display: block; }
.document-item { flex-direction: row; align-items: center; padding: 5px 4px; }
.document-item-text { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 1px; }
.document-item-text > span { color: #828c9c; }
.document-actions { display: flex; align-items: center; gap: 1px; padding-right: 3px; }
.document-actions .icon-button {
  width: 24px;
  min-width: 24px;
  height: 24px;
  border-radius: 6px;
  opacity: 0;
  color: #8d97a7;
}
.document-row:hover .document-actions .icon-button,
.document-row:focus-within .document-actions .icon-button,
.document-row.active .document-pin,
.document-row.pinned .document-pin { opacity: 1; }
.document-pin.active { color: #aab8ff; background: rgba(100,120,232,.13); }
.document-pin.active svg { fill: currentColor; }
.document-order:hover, .document-pin:hover { color: #d8deff; background: rgba(141,162,255,.10); }
.document-delete { opacity: 0; }
.document-actions .icon-button:disabled { opacity: .18; pointer-events: none; }
.document-row:not(.pinned) .document-order { display: none; }

.confirm-dialog { width: min(430px, calc(100vw - 24px)); }
.confirm-form {
  display: grid;
  grid-template-columns: 40px minmax(0,1fr);
  gap: 12px;
  padding: 17px;
}
.confirm-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: #ff8b94;
  background: rgba(255,114,125,.11);
}
.confirm-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.confirm-copy h2 { margin: 1px 0 5px; font-size: 16px; }
.confirm-copy p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.confirm-copy strong { color: var(--text); }
.confirm-form menu { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 7px; margin: 2px 0 0; padding: 0; }

@media (hover: none), (pointer: coarse) {
  .document-actions .icon-button { opacity: 1; }
  .document-row { min-height: 50px; }
  .document-actions .icon-button { width: 28px; min-width: 28px; height: 28px; }
}


/* 0.11.4 — Lattice visual refresh and responsive rich documents */
:root {
  --brand-a: #8ea2ff;
  --brand-b: #66e0c2;
  --brand-glow: rgba(102,224,194,.16);
}
body {
  background:
    radial-gradient(circle at 18% -20%, rgba(105,124,232,.08), transparent 38%),
    radial-gradient(circle at 88% 0%, rgba(78,206,178,.045), transparent 31%),
    var(--bg);
}
.topbar {
  background: rgba(13,16,23,.93);
  box-shadow: 0 1px rgba(255,255,255,.025), 0 10px 35px rgba(0,0,0,.15);
}
.nav-toggle svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-mark {
  gap: 7px;
  min-width: 0;
  padding-right: 2px;
  color: #f1f3f8;
  font-weight: 720;
  letter-spacing: -.015em;
}
.brand-mark img {
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 4px 12px var(--brand-glow));
}
#brand-name {
  overflow: hidden;
  max-width: 142px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-switcher {
  border-color: rgba(255,255,255,.08);
  background: rgba(255,255,255,.035);
}
.document-list {
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.document-row {
  position: relative;
  isolation: isolate;
  transition: background-color .12s ease, box-shadow .12s ease;
}
.document-row::after {
  content: '';
  position: absolute;
  inset: 3px;
  z-index: -1;
  border-radius: 8px;
  opacity: 0;
  background: linear-gradient(90deg, rgba(142,162,255,.1), rgba(102,224,194,.04));
  transition: opacity .12s ease;
}
.document-row:hover::after { opacity: 1; }
.document-row.active {
  background: rgba(94,111,180,.16);
  box-shadow: inset 2px 0 var(--brand-a);
}
.document-item {
  position: relative;
  z-index: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.document-actions {
  position: relative;
  z-index: 2;
}
.editor {
  contain: layout style;
  max-width: 900px;
}
.editor.document-enter {
  animation: lattice-document-enter .16s cubic-bezier(.2,.75,.25,1);
}
@keyframes lattice-document-enter {
  from { opacity: .72; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
.block {
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.block [contenteditable] strong,
.block [contenteditable] b { font-weight: 750; color: #f4f5f9; }
.block [contenteditable] em,
.block [contenteditable] i { color: #d5dcff; }
.block [contenteditable] code {
  padding: .08em .34em;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 5px;
  color: #b9f5df;
  background: rgba(102,224,194,.07);
  font: .92em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.block [contenteditable] a { color: #a9b7ff; text-decoration: underline; text-decoration-color: rgba(169,183,255,.45); }
.inline-format strong, .inline-format em { font-size: 13px; }
.editor-toolbar {
  border-color: rgba(142,162,255,.18);
  background: rgba(17,20,28,.9);
}
.editor-toolbar.is-collapsed {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-18px) scale(.985);
  box-shadow: none;
}
.notes-style-toolbar-collapsed .editor-toolbar.is-collapsed {
  border-color: transparent;
}
.tool-button.primary,
.button.primary {
  border-color: rgba(142,162,255,.34);
  background: linear-gradient(135deg, #6578e8, #6c87e8 55%, #58bfae);
  box-shadow: 0 5px 18px rgba(74,91,180,.25);
}
.status-dot.online { box-shadow: 0 0 0 3px rgba(88,211,155,.1), 0 0 14px rgba(88,211,155,.32); }
@media (max-width: 880px) {
  #brand-name { max-width: 94px; }
}
@media (max-width: 720px) {
  .brand-mark { padding-right: 0; }
  #brand-name { display: none; }
  .editor { padding-inline: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .editor.document-enter { animation: none; }
  .document-row, .document-row::after, .block { transition: none; }
}


/* ---------------- Lattice 0.12 interaction system ---------------- */
.menu-anchor { position: relative; display: inline-flex; }
.topbar-menu-anchor { z-index: 80; }
.command-menu {
  position: absolute;
  z-index: 120;
  min-width: 188px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 11px;
  background: rgba(24,27,34,.98);
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  backdrop-filter: blur(18px);
}
.command-menu[hidden] { display: none !important; }
.command-menu button {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  border-radius: 7px;
  padding: 6px 9px;
  color: var(--text);
  background: transparent;
  text-align: left;
  white-space: nowrap;
}
.command-menu button:hover, .command-menu button:focus-visible { background: rgba(255,255,255,.075); outline: 0; }
.command-menu kbd { color: var(--muted); font: 10px/1 ui-monospace, monospace; }
.workspace-menu { top: calc(100% + 6px); right: 0; width: 218px; }
.toolbar-menu { top: calc(100% + 7px); left: 0; }
.canvas-toolbar .toolbar-menu { top: calc(100% + 8px); }
.menu-separator { height: 1px; margin: 4px 3px; background: rgba(255,255,255,.08); }
.menu-diagnostics { display: flex; align-items: center; gap: 9px; min-height: 31px; padding: 5px 9px; color: var(--muted); font-size: 11px; }
.menu-trigger.text-trigger, .tool-button.text-trigger { width: auto; min-width: auto; padding-inline: 9px; gap: 5px; font-size: 11px; }
.tool-button.text-trigger > span { color: var(--muted); }
#document-insert-contributions, #canvas-insert-contributions { display: contents; }
#document-insert-contributions > button, #canvas-insert-contributions > button {
  width: 100%;
  min-height: 34px;
  justify-content: flex-start;
  border: 0;
  background: transparent;
  box-shadow: none;
}
#document-insert-contributions > button svg, #canvas-insert-contributions > button svg { width: 16px; height: 16px; margin-right: 8px; }
.sync-state.healthy {
  width: 8px;
  min-width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(88,211,155,.11);
}
.sync-state.saving, .sync-state.connecting, .sync-state.reconnecting,
.sync-state.error, .sync-state.conflict, .sync-state.offline, .sync-state.readonly {
  padding: 3px 7px;
  border-radius: 10px;
  background: rgba(255,255,255,.05);
  font-size: 10px;
}
#open-ai { min-width: 31px; width: 31px; padding: 0; }
.plugin-state { color: var(--muted); font-size: 11px; }

.inspector-disclosure, .nested-disclosure, .advanced-settings, .ai-options, .recovery-actions, .plugin-settings {
  border-top: 1px solid rgba(255,255,255,.075);
}
.inspector-disclosure:first-of-type { border-top: 0; }
.inspector-disclosure > summary, .nested-disclosure > summary, .advanced-settings > summary,
.ai-options > summary, .recovery-actions > summary, .plugin-settings > summary {
  list-style: none;
  display: flex;
  align-items: center;
  min-height: 34px;
  color: #cfd5e0;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}
.inspector-disclosure > summary::-webkit-details-marker,
.nested-disclosure > summary::-webkit-details-marker,
.advanced-settings > summary::-webkit-details-marker,
.ai-options > summary::-webkit-details-marker,
.recovery-actions > summary::-webkit-details-marker,
.plugin-settings > summary::-webkit-details-marker { display: none; }
.inspector-disclosure > summary::after, .nested-disclosure > summary::after,
.advanced-settings > summary::after, .ai-options > summary::after,
.recovery-actions > summary::after, .plugin-settings > summary::after {
  content: '›';
  margin-left: auto;
  color: var(--muted);
  transform: rotate(0deg);
  transition: transform .12s ease;
}
.inspector-disclosure[open] > summary::after, .nested-disclosure[open] > summary::after,
.advanced-settings[open] > summary::after, .ai-options[open] > summary::after,
.recovery-actions[open] > summary::after, .plugin-settings[open] > summary::after { transform: rotate(90deg); }
.inspector-disclosure > :not(summary) { margin-bottom: 9px; }
.nested-disclosure { margin-top: 7px; }
.paint-section { margin: 0; padding: 0; border: 0; background: transparent; }
.paint-target { display: flex; gap: 3px; margin-bottom: 7px; }
.paint-target button { min-height: 25px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); }
.paint-target button.active { color: var(--text); background: var(--panel-3); }
.rounding-control { margin-top: 7px; }
.node-actions { display: flex; gap: 5px; margin-top: 6px; }
.inspector-actions .button { flex: 1 1 46%; }
.canvas-inspector { padding: 8px 10px; }
.canvas-inspector .inspector-header { margin-bottom: 2px; }

.context-chip {
  align-self: flex-start;
  padding: 4px 8px;
  border: 1px solid rgba(141,162,255,.24);
  border-radius: 999px;
  color: #b9c5ff;
  background: rgba(100,120,232,.08);
  font-size: 10px;
}
.prompt-field textarea { min-height: 122px; padding: 10px; font-size: 13px; line-height: 1.45; resize: vertical; }
.quick-actions { display: flex; flex-wrap: wrap; }
.quick-actions button { flex: 0 1 auto; padding-inline: 9px; font-size: 11px; }
.ai-options { padding-top: 1px; }
.ai-options > :not(summary) { margin-bottom: 8px; }
.visually-hidden {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
  margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important;
}

.dialog-tabs {
  display: flex;
  gap: 3px;
  margin: 12px 0 10px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg);
}
.dialog-tabs button {
  flex: 1;
  min-height: 31px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
}
.dialog-tabs button.active { color: var(--text); background: var(--panel-3); }
.dialog-tab-panel { min-height: 100px; }
.dialog-tab-panel[hidden] { display: none !important; }
.settings-with-tabs { min-height: 380px; }
.advanced-settings { margin-top: 9px; }
.advanced-settings .settings-grid { margin-bottom: 3px; }
.recovery-actions { margin-top: 8px; padding-top: 3px; }
.recovery-actions button { margin: 3px 5px 2px 0; }
.snapshot-row small { color: var(--muted); }
.snapshot-tier { opacity: .72; }
.label-form .status { display: none; }

@media (max-width: 720px) {
  .workspace-menu { position: fixed; top: calc(var(--topbar) + 5px); right: 5px; }
  .toolbar-menu { position: fixed; top: 48px; left: 50%; transform: translateX(-50%); width: min(260px, calc(100vw - 16px)); }
  #canvas-view .toolbar-menu { top: 47px; }
  .canvas-toolbar .toolbar-content { overflow: visible; }
  .canvas-toolbar { overflow: visible; }
  .editor-toolbar { max-width: calc(100vw - 12px); }
}

#workspace-menu #export-button { display: flex; }
.presentation-options, .slide-group-advanced, .embed-permissions {
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.presentation-options > summary, .slide-group-advanced > summary, .embed-permissions > summary,
.embed-sample-menu > summary {
  list-style: none;
  min-height: 32px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.presentation-options > summary::-webkit-details-marker, .slide-group-advanced > summary::-webkit-details-marker,
.embed-permissions > summary::-webkit-details-marker, .embed-sample-menu > summary::-webkit-details-marker { display: none; }
.embed-editor-options.compact { grid-template-columns: 1fr 180px; }
.embed-sample-menu { position: relative; }
.embed-sample-menu[open] > button { position: absolute; right: 0; bottom: 34px; width: 130px; z-index: 5; }
.slide-group-row { align-items: center; }
.slide-number.group { opacity: .45; }
@media (max-width: 720px) {
  #workspace-menu #export-button { display: flex; }
  .embed-editor-options.compact { grid-template-columns: 1fr; }
}

/* ---------------- Lattice 0.13 high-throughput input system ---------------- */
:root {
  --visual-height: 100dvh;
  --keyboard-offset: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
.app-shell {
  height: var(--visual-height);
  grid-template-rows: calc(var(--topbar) + var(--safe-top)) minmax(0, 1fr);
}
.topbar {
  height: calc(var(--topbar) + var(--safe-top));
  padding-top: calc(4px + var(--safe-top));
  padding-left: calc(8px + var(--safe-left));
  padding-right: calc(8px + var(--safe-right));
}
.resize-handle-hit { fill: transparent; stroke: none; pointer-events: all; cursor: nwse-resize; }
.resize-handle-hit[data-handle="ne"], .resize-handle-hit[data-handle="sw"] { cursor: nesw-resize; }
.marquee-box { fill: rgba(100,120,232,.08); }

.context-action-menu {
  position: absolute;
  z-index: 85;
  width: 190px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  background: rgba(22,25,32,.98);
  box-shadow: 0 18px 55px rgba(0,0,0,.48);
  backdrop-filter: blur(18px);
}
.context-action-menu[hidden], .context-action-section[hidden] { display: none !important; }
.context-action-section { display: grid; gap: 2px; }
.context-action-menu button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
}
.context-action-menu button:hover, .context-action-menu button:focus-visible { background: rgba(255,255,255,.08); outline: 0; }
.context-action-menu button.danger { color: #ff9aa2; }
.gesture-indicator {
  position: absolute;
  z-index: 84;
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 2px solid rgba(141,162,255,.9);
  border-radius: 50%;
  box-shadow: 0 0 0 8px rgba(100,120,232,.12);
  pointer-events: none;
  animation: lattice-hold-pulse .8s ease-in-out infinite alternate;
}
@keyframes lattice-hold-pulse { from { transform: scale(.88); opacity: .65; } to { transform: scale(1.04); opacity: 1; } }

.quick-actions-dialog { width: min(580px, calc(100vw - 24px)); padding: 0; }
.quick-actions-form { display: grid; grid-template-rows: auto minmax(80px, 420px) auto; max-height: min(620px, calc(var(--visual-height) - 24px)); }
.quick-actions-form header { display: flex; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); }
.quick-actions-form header input { flex: 1; min-height: 42px; border: 0; outline: 0; background: transparent; font-size: 16px; }
.quick-actions-list { overflow: auto; padding: 6px; }
.quick-actions-list button { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 9px; padding: 7px 10px; background: transparent; text-align: left; }
.quick-actions-list button:hover, .quick-actions-list button.active { background: var(--panel-3); }
.quick-actions-list kbd, .quick-actions-form footer kbd { color: var(--muted); font: 11px/1 ui-monospace, monospace; }
.quick-actions-form footer { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.quick-actions-form footer span { margin-right: 8px; }

.inspector-sheet-handle { display: none; width: 100%; height: 22px; border: 0; background: transparent; padding: 0; touch-action: none; }
.inspector-sheet-handle span { display: block; width: 42px; height: 4px; margin: 7px auto; border-radius: 99px; background: rgba(255,255,255,.28); }

html.has-touch .icon-button, html.has-touch .tool-button { min-width: 44px; height: 44px; }
html.has-touch .button { min-height: 44px; }
html.has-touch .command-menu button, html.has-touch .context-action-menu button { min-height: 46px; }
html.has-touch .canvas-inspector input, html.has-touch .canvas-inspector textarea,
html.has-touch .canvas-inspector select, html.has-touch .settings-form input,
html.has-touch .settings-form select, html.has-touch .ai-section input,
html.has-touch .ai-section select, html.has-touch .ai-section textarea { min-height: 42px; }
html.has-touch .document-item { min-height: 52px; padding-block: 9px; }
html.has-touch .block { min-height: 44px; padding-block: 8px; }
html.has-pen .canvas-stage { cursor: crosshair; }

body.overlay-sidebar .app-shell { grid-template-columns: 1fr; grid-template-areas: "top" "work"; }
body.overlay-sidebar .sidebar {
  position: fixed;
  top: calc(var(--topbar) + var(--safe-top));
  bottom: calc(var(--bottom) + var(--safe-bottom));
  left: 0;
  width: min(78vw, 340px);
  transform: translateX(-104%);
  transition: transform .18s ease;
  box-shadow: 14px 0 38px rgba(0,0,0,.42);
}
body.overlay-sidebar .sidebar.open { transform: translateX(0); }
html.has-touch body.overlay-sidebar { --bottom: 54px; }
html.has-touch body.overlay-sidebar .bottom-nav {
  display: grid;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--bottom) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  z-index: 32;
  grid-template-columns: repeat(4,1fr);
  border-top: 1px solid var(--line);
  background: rgba(21,24,30,.97);
}
html.has-touch body.overlay-sidebar .bottom-nav button { border: 0; background: transparent; color: var(--muted); }
html.has-touch body.overlay-sidebar .bottom-nav button.active { color: white; background: var(--panel-2); }
html.has-touch body.overlay-sidebar .editor { padding-bottom: calc(120px + var(--bottom) + var(--safe-bottom)); }
html.has-touch body.overlay-sidebar .ai-panel { bottom: calc(var(--bottom) + var(--safe-bottom)); }
html.has-touch body.overlay-sidebar .canvas-status,
html.has-touch body.overlay-sidebar .zoom-toolbar { bottom: calc(var(--bottom) + var(--safe-bottom) + 8px); }

html.has-touch body.overlay-sidebar .canvas-inspector {
  display: block;
  top: auto;
  left: max(6px, var(--safe-left));
  right: max(6px, var(--safe-right));
  bottom: calc(var(--bottom) + var(--safe-bottom) + 5px);
  width: auto;
  height: var(--sheet-height, min(46vh, 430px));
  max-height: calc(var(--visual-height) - var(--topbar) - var(--bottom) - var(--safe-top) - var(--safe-bottom) - 14px);
  padding-top: 0;
  border-radius: 16px 16px 0 0;
  transition: height .18s ease, transform .18s ease;
  overscroll-behavior: contain;
}
html.has-touch body.overlay-sidebar .canvas-inspector[hidden] { display: none; }
html.has-touch body.overlay-sidebar .canvas-inspector[data-sheet-state="collapsed"] { height: 76px; overflow: hidden; }
html.has-touch body.overlay-sidebar .canvas-inspector[data-sheet-state="half"] { height: min(46vh, 430px); }
html.has-touch body.overlay-sidebar .canvas-inspector[data-sheet-state="full"] { height: min(78vh, 760px); }
html.has-touch body.overlay-sidebar .canvas-inspector[data-sheet-state="dragging"] { height: var(--sheet-height); transition: none; }
html.has-touch body.overlay-sidebar .inspector-sheet-handle { display: block; position: sticky; top: 0; z-index: 3; background: inherit; }
html.has-touch body.overlay-sidebar .canvas-inspector[data-sheet-state="collapsed"] .inspector-disclosure,
html.has-touch body.overlay-sidebar .canvas-inspector[data-sheet-state="collapsed"] .inspector-section { display: none; }
body.canvas-focus .inspector-sheet-handle { display: block; }
body.keyboard-open .editor-toolbar { opacity: .35; pointer-events: none; }

@media (min-width: 680px) and (max-width: 1180px) {
  body[data-layout="medium"] .brand-mark span { display: none; }
  body[data-layout="medium"] .document-title { width: min(34vw, 360px); }
  body[data-layout="medium"] .canvas-toolbar { max-width: calc(100% - 104px); }
}

@media (max-width: 679px) {
  body[data-layout="compact"] .topbar { gap: 4px; }
  body[data-layout="compact"] .workspace-switcher,
  body[data-layout="compact"] .user-chip span:last-child { display: none; }
  body[data-layout="compact"] .document-title { min-width: 70px; }
  body[data-layout="compact"] .canvas-status { display: none; }
  .context-action-menu { width: min(230px, calc(100vw - 16px)); }
}

.block-action-handle {
  position: absolute;
  left: -31px;
  top: 3px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  opacity: 0;
  transition: opacity .12s ease, background .12s ease;
}
.block:hover .block-action-handle, .block.selected .block-action-handle, .block-action-handle:focus-visible { opacity: 1; }
.block-action-handle:hover, .block-action-handle:focus-visible { color: var(--text); background: var(--panel-3); outline: 0; }
.ghost-insert-row {
  width: min(100%, 720px);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin: 20px auto 30px;
  padding: 4px 18px;
  border: 0;
  background: transparent;
  opacity: .26;
  transform: translateY(2px);
  pointer-events: auto;
  transition: opacity .16s ease, transform .16s ease;
}
.ghost-insert-line {
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(138,154,192,.18), transparent);
}
.ghost-insert-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px dashed rgba(142,162,255,.18);
  border-radius: 999px;
  color: color-mix(in srgb, var(--muted) 82%, transparent);
  background: rgba(83,96,145,.025);
  box-shadow: none;
  transition: border-color .16s ease, background .16s ease, transform .16s ease, color .16s ease;
}
.ghost-insert-plus {
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(142,162,255,.22);
  border-radius: 999px;
  color: #b9c6f5;
  background: rgba(101,120,232,.07);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}
.ghost-insert-copy {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .01em;
}
.ghost-insert-row:hover,
.ghost-insert-row:focus-visible,
.ghost-insert-row:focus-within {
  opacity: .9;
  transform: none;
}
.ghost-insert-row:hover .ghost-insert-pill,
.ghost-insert-row:focus-visible .ghost-insert-pill {
  border-color: rgba(142,162,255,.36);
  background: rgba(101,120,232,.07);
  color: #d7dffb;
  transform: translateY(-1px);
}
body.workspace-readonly .ghost-insert-row {
  display: none;
}
.block-action-handle { cursor: grab; touch-action: none; }
.block-action-handle:active { cursor: grabbing; }
.block.dragging {
  opacity: .58;
  transform: scale(.995);
  border-color: rgba(142,162,255,.32);
  background: rgba(101,120,232,.055);
}
.block.drop-before::before,
.block.drop-after::after {
  content: '';
  position: absolute;
  z-index: 5;
  left: 8px;
  right: 8px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 82%, white), transparent);
  box-shadow: 0 0 0 1px rgba(142,162,255,.08), 0 0 18px rgba(101,120,232,.22);
  pointer-events: none;
}
.block.drop-before::before { top: -5px; }
.block.drop-after::after { bottom: -5px; }
body.notes-block-dragging .block:not(.dragging) { transition: transform .12s ease, border-color .12s ease, background .12s ease; }
.document-block-menu { position: absolute; }
html.has-touch .block { padding-left: 42px; }
html.has-touch .block-action-handle { left: 5px; top: 6px; width: 34px; height: 34px; opacity: 1; touch-action: manipulation; }

html.has-touch body.overlay-sidebar.keyboard-open .ai-panel { bottom: calc(var(--bottom) + var(--safe-bottom) + var(--keyboard-offset)); }

/* Lattice 0.14 declarative contribution surfaces */
.topbar-contributions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.topbar-contributions:empty,
#workspace-menu-contributions:empty,
#document-block-action-contributions:empty,
#canvas-context-action-contributions:empty,
#canvas-inspector-contributions:empty,
#settings-contributions:empty { display: none; }
#workspace-menu-contributions,
#document-block-action-contributions,
#canvas-context-action-contributions { display: contents; }
#canvas-inspector-contributions > [data-contribution-id] {
  display: block;
  border-top: 1px solid rgba(255,255,255,.075);
}
#settings-contributions > [data-contribution-id] { margin-block: 8px; }
.topbar-contributions > [data-contribution-id] {
  flex: 0 0 auto;
}
.contribution-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.contribution-icon svg { width: 17px; height: 17px; }


/* ---------------- Lattice 0.15 programmable content and data ---------------- */
.topbar-contributions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.topbar-contributions > [data-contribution-id] { display: inline-flex; }
.data-topbar-button { min-width: 46px; }

.data-sources-dialog,
.content-reference-dialog,
.local-history-dialog {
  width: min(1120px, calc(100vw - 24px));
  max-width: none;
  max-height: min(820px, calc(var(--visual-height, 100vh) - 24px));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0,0,0,.52);
}
.data-sources-form,
.content-reference-dialog form,
.local-history-dialog form {
  display: flex;
  min-height: min(700px, calc(var(--visual-height, 100vh) - 48px));
  flex-direction: column;
  padding: 0;
}
.data-sources-form > header,
.content-reference-dialog header,
.local-history-dialog header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.data-sources-form h2,
.content-reference-dialog h2,
.local-history-dialog h2 { margin: 0; font-size: 18px; }
.data-sources-form header p,
.content-reference-dialog header p,
.local-history-dialog header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }

.data-source-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.data-source-toolbar span { color: var(--muted); font-size: 11px; }
.data-source-layout {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: 250px minmax(0, 1fr);
}
.data-source-layout > aside {
  display: flex;
  min-height: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(0,0,0,.08);
}
.data-resource-list,
.data-table-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px;
  overflow: auto;
}
.data-resource-list { min-height: 160px; flex: 1; }
.data-table-list { max-height: 220px; border-top: 1px solid var(--line); }
.data-resource-list button,
.data-table-list button {
  display: flex;
  min-height: 38px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 7px 9px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.data-table-list button { min-height: 32px; }
.data-resource-list button:hover,
.data-resource-list button.active,
.data-table-list button:hover,
.data-table-list button.active { background: rgba(255,255,255,.075); }
.data-resource-list small { color: var(--muted); font-size: 10px; }
.data-editor {
  min-width: 0;
  padding: 14px;
  overflow: auto;
}
.data-editor > header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}
.data-editor h3 { margin: 0; font-size: 16px; }
.data-editor p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.data-editor-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.data-empty,
.data-adapter-state {
  display: grid;
  min-height: 220px;
  place-content: center;
  gap: 7px;
  color: var(--muted);
  text-align: center;
}
.data-empty strong,
.data-adapter-state strong { color: var(--text); }

.data-table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0,0,0,.12);
}
.data-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}
.data-table th,
.data-table td {
  min-width: 110px;
  max-width: 320px;
  height: 31px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 5px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 650;
  text-align: left;
}
.data-table input {
  width: 100%;
  min-height: 26px;
  border: 0;
  padding: 2px 4px;
  background: transparent;
  color: var(--text);
}
.data-table input:focus { outline: 1px solid var(--accent); border-radius: 4px; }
.data-view-block,
.block-reference-card,
.canvas-reference-block,
.javascript-block {
  display: grid;
  gap: 9px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(9,13,22,.58);
}
.data-view-block > header,
.block-reference-card > header,
.canvas-reference-block > header,
.javascript-block > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.data-view-block header > div,
.block-reference-card header > div,
.canvas-reference-block header > div,
.javascript-block header > div { display: grid; gap: 2px; }
.data-view-block header small,
.block-reference-card header small,
.canvas-reference-block header small,
.javascript-block header small { color: var(--muted); font-size: 10px; }

.canvas-data-view,
.canvas-block-reference,
.canvas-javascript-result {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(141,162,255,.45);
  border-radius: 12px;
  padding: 10px;
  background: #0d1320;
  color: #f4f6fb;
  font: 12px/1.35 system-ui, sans-serif;
}
.canvas-data-view header,
.canvas-block-reference header,
.canvas-javascript-result header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 7px;
}
.canvas-data-view header small,
.canvas-block-reference header small,
.canvas-javascript-result header small { color: #99a6ba; }
.canvas-block-reference button {
  min-height: 26px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: inherit;
}
.canvas-data-view .data-table-wrap { max-height: calc(100% - 34px); }
.canvas-data-view .data-table { font-size: 10px; }
.canvas-data-view .data-table th,
.canvas-data-view .data-table td { min-width: 84px; height: 25px; padding: 3px 5px; }

.reference-source-preview { min-height: 54px; color: var(--text); }
.reference-source-preview p { margin: 0; white-space: pre-wrap; }
.reference-source-preview pre {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  color: var(--muted);
  white-space: pre-wrap;
}
.reference-missing {
  display: grid;
  min-height: 64px;
  place-content: center;
  color: var(--muted);
  text-align: center;
}
.canvas-reference-preview {
  min-height: 180px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
}
.canvas-reference-preview svg { display: block; width: 100%; height: 240px; }

.content-reference-dialog {
  width: min(660px, calc(100vw - 24px));
}
.content-reference-dialog form { min-height: min(620px, calc(var(--visual-height, 100vh) - 48px)); }
.content-reference-dialog form > label { display: grid; gap: 5px; margin: 12px 16px 6px; color: var(--muted); font-size: 11px; }
.reference-block-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 8px 16px 16px;
  overflow: auto;
}
.reference-block-choice {
  display: flex;
  min-height: 45px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 10px;
  background: rgba(255,255,255,.035);
  color: var(--text);
  text-align: left;
}
.reference-block-choice:hover { border-color: rgba(141,162,255,.35); background: rgba(141,162,255,.08); }
.reference-block-choice small { color: var(--muted); }

.javascript-source {
  box-sizing: border-box;
  width: 100%;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px;
  background: #080c14;
  color: #e8edf8;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  resize: vertical;
  tab-size: 2;
}
.javascript-inputs { border-top: 1px solid var(--line); }
.javascript-inputs summary {
  min-height: 31px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.javascript-input-list { display: flex; flex-wrap: wrap; gap: 8px 14px; padding: 2px 0 8px; }
.javascript-input-list label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.javascript-output,
.javascript-result-table {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px;
  background: rgba(0,0,0,.15);
  white-space: pre-wrap;
}
.javascript-result-table { padding: 0; }
.javascript-result-table table { width: 100%; border-collapse: collapse; font-size: 11px; }
.javascript-result-table th,
.javascript-result-table td { border: 1px solid var(--line); padding: 5px 7px; text-align: left; }
.javascript-error {
  max-height: 160px;
  margin: 0;
  overflow: auto;
  border: 1px solid rgba(255,114,125,.35);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255,114,125,.07);
  color: #ffb2b9;
  white-space: pre-wrap;
}
.javascript-chart { display: grid; gap: 5px; }
.javascript-chart svg { width: 100%; max-height: 240px; color: var(--accent); }
.javascript-chart-row {
  display: grid;
  grid-template-columns: minmax(70px, 130px) minmax(40px, 1fr) 70px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.javascript-chart-row i {
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent) calc(var(--bar) * 100%), rgba(255,255,255,.06) 0);
}
.javascript-chart-row strong { text-align: right; }
.javascript-empty-output { color: var(--muted); }
.json-output { font-family: ui-monospace, monospace; font-size: 11px; }

.local-history-dialog { width: min(720px, calc(100vw - 24px)); }
.local-history-dialog form { min-height: min(620px, calc(var(--visual-height, 100vh) - 48px)); }
.local-history-actions { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.local-history-list { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 5px; padding: 10px 14px 16px; overflow: auto; }
.local-history-row {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  background: rgba(255,255,255,.025);
}
.local-history-row > div { display: grid; gap: 3px; }
.local-history-row small { color: var(--muted); }

.block-loading { color: var(--muted); font-size: 11px; }

@media (max-width: 900px), (any-pointer: coarse) and (max-width: 1180px) {
  .data-sources-dialog,
  .content-reference-dialog,
  .local-history-dialog {
    width: calc(100vw - max(12px, var(--safe-left)) - max(12px, var(--safe-right)));
    max-height: calc(var(--visual-height, 100vh) - max(12px, var(--safe-top)) - max(12px, var(--safe-bottom)));
  }
  .data-source-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .data-table th,
  .data-table td { min-width: 128px; height: 38px; }
  .data-table input { min-height: 34px; }
  .reference-block-choice { min-height: 52px; }
}
@media (max-width: 680px) {
  .data-source-layout { grid-template-columns: 1fr; grid-template-rows: 185px minmax(0, 1fr); }
  .data-source-layout > aside { border-right: 0; border-bottom: 1px solid var(--line); }
  .data-resource-list { min-height: 90px; }
  .data-table-list { max-height: 70px; flex-direction: row; }
  .data-table-list button { min-width: 110px; }
  .data-source-toolbar span { display: none; }
  .javascript-source { min-height: 190px; }
  .topbar-contributions .data-topbar-button { display: none; }
}


/* ---------------- Lattice 0.16 resource integrity ---------------- */
.resource-integrity-healthy {
  display: grid;
  min-height: 240px;
  place-content: center;
  gap: 6px;
  text-align: center;
  color: var(--muted);
}
.resource-integrity-healthy strong { color: var(--text); font-size: 16px; }
.resource-integrity-list { display: grid; gap: 7px; }
.resource-integrity-issue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255,255,255,.025);
}
.resource-integrity-issue.severity-error { border-color: rgba(255,114,125,.4); }
.resource-integrity-issue > div:first-child { min-width: 0; }
.resource-integrity-issue p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.resource-integrity-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
@media (max-width: 680px) {
  .resource-integrity-issue { align-items: stretch; flex-direction: column; }
  .resource-integrity-actions { justify-content: flex-start; }
}


/* ---------------- Lattice 0.17 Applications ---------------- */
.applications-dialog,
.application-preview-dialog {
  width: min(1180px, calc(100vw - 24px));
  max-width: none;
  max-height: min(860px, calc(var(--visual-height, 100vh) - 24px));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0,0,0,.55);
}
.applications-shell {
  display: flex;
  min-height: min(760px, calc(var(--visual-height, 100vh) - 48px));
  flex-direction: column;
}
.applications-header,
.application-preview-shell > header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}
.applications-header h2 { margin: 0; font-size: 18px; }
.applications-header p,
.application-preview-shell > header small {
  display: block;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.applications-toolbar {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
}
.applications-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}
.applications-layout {
  display: grid;
  min-height: 0;
  flex: 1;
  grid-template-columns: 260px minmax(0, 1fr);
}
.applications-layout > aside {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 3px;
  border-right: 1px solid var(--line);
  padding: 8px;
  overflow: auto;
  background: rgba(0,0,0,.08);
}
.application-list-item {
  display: grid;
  min-height: 48px;
  align-content: center;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.application-list-item:hover,
.application-list-item.active {
  border-color: rgba(141,162,255,.28);
  background: rgba(141,162,255,.09);
}
.application-list-item small { color: var(--muted); font-size: 10px; }
.applications-layout > main {
  min-width: 0;
  min-height: 0;
  padding: 14px;
  overflow: auto;
}
.applications-empty,
.application-empty-builds {
  display: grid;
  min-height: 220px;
  place-content: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}
.applications-empty strong { color: var(--text); }
.application-editor { display: grid; gap: 14px; }
.application-editor > header,
.application-diagnostics > header,
.application-build-history > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.application-editor h3 { margin: 4px 0 0; font-size: 20px; }
.application-state {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(148,163,184,.12);
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .03em;
}
.application-state.valid { background: rgba(74,222,128,.1); color: #86efac; }
.application-state.invalid { background: rgba(248,113,113,.1); color: #fca5a5; }
.application-header-actions,
.application-build-history > header > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.application-fields {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}
.application-fields > label,
.application-viewport label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}
.application-fields input,
.application-fields textarea,
.application-fields select {
  width: 100%;
}
.application-fields textarea { min-height: 74px; resize: vertical; }
.application-viewport {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) minmax(160px, .8fr);
  gap: 8px;
}
.application-fields .check-label,
.application-permissions .check-label {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 7px;
}
.application-fields .check-label input,
.application-permissions .check-label input { width: auto; }
.application-permissions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 11px;
}
.application-dependency-summary,
.application-diagnostics,
.application-build-history {
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.application-dependency-summary h4,
.application-diagnostics h4,
.application-build-history h4 { margin: 0; font-size: 13px; }
.application-dependency-summary > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 6px;
}
.application-dependency-summary span {
  display: grid;
  min-height: 48px;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 9px;
  color: var(--muted);
  font-size: 10px;
}
.application-dependency-summary strong { color: var(--text); font-size: 17px; }
.application-diagnostics > div { display: grid; gap: 5px; }
.application-diagnostic {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  background: rgba(255,255,255,.025);
}
.application-diagnostic.blocking { border-color: rgba(248,113,113,.36); }
.application-diagnostic.warning { border-color: rgba(250,204,21,.25); }
.application-diagnostic strong { font-size: 10px; letter-spacing: .03em; }
.application-diagnostic p { margin: 0; font-size: 11px; }
.application-diagnostic small { color: var(--muted); }
.application-valid-message {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(74,222,128,.25);
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--muted);
}
.application-valid-message strong { color: #86efac; }
.application-build-history > div { display: grid; gap: 5px; }
.application-build-row {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  background: rgba(255,255,255,.025);
}
.application-build-row > div:first-child { display: grid; min-width: 0; gap: 3px; }
.application-build-row strong {
  overflow: hidden;
  font: 11px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace;
  text-overflow: ellipsis;
}
.application-build-row small { color: var(--muted); font-size: 10px; }
.application-build-row > div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}
.application-preview-dialog {
  width: min(1440px, calc(100vw - 16px));
  max-height: calc(var(--visual-height, 100vh) - 16px);
}
.application-preview-shell {
  display: grid;
  height: calc(var(--visual-height, 100vh) - 24px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.application-preview-shell > header > div:last-child {
  display: flex;
  align-items: center;
  gap: 6px;
}
.application-preview-mount {
  min-height: 0;
  overflow: hidden;
  background: #070b14;
}
.application-preview-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #0b1020;
}
.application-preview-logs {
  max-height: 160px;
  border-top: 1px solid var(--line);
  padding: 7px 12px;
  overflow: auto;
}
.application-preview-logs summary { color: var(--muted); font-size: 11px; cursor: pointer; }
.application-preview-logs pre {
  margin: 7px 0;
  color: var(--muted);
  font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
}
@media (max-width: 900px), (any-pointer: coarse) and (max-width: 1180px) {
  .applications-dialog {
    width: calc(100vw - max(12px, var(--safe-left)) - max(12px, var(--safe-right)));
    max-height: calc(var(--visual-height, 100vh) - max(12px, var(--safe-top)) - max(12px, var(--safe-bottom)));
  }
  .applications-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .application-list-item,
  .application-build-row button,
  .applications-toolbar button { min-height: 44px; }
}
@media (max-width: 720px) {
  .applications-layout { grid-template-columns: 1fr; grid-template-rows: 150px minmax(0, 1fr); }
  .applications-layout > aside {
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .application-list-item { min-width: 170px; }
  .application-editor > header,
  .application-build-history > header,
  .application-build-row { align-items: stretch; flex-direction: column; }
  .application-header-actions,
  .application-build-history > header > div,
  .application-build-row > div:last-child { justify-content: flex-start; }
  .application-viewport { grid-template-columns: 1fr 1fr; }
  .application-dependency-summary > div { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
  .applications-topbar-button { display: none; }
}

.application-dependency-editor {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.application-dependency-editor summary {
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.application-dependency-editor > p {
  margin: 7px 0;
  color: var(--muted);
  font-size: 10px;
}
.application-dependency-editor > label {
  display: grid;
  gap: 4px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}
.application-dependency-editor textarea {
  min-height: 44px;
  font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.application-compare-builds { justify-self: start; }
.application-build-inspection {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(141,162,255,.32);
  border-radius: 10px;
  padding: 9px;
  background: rgba(141,162,255,.055);
}
.application-build-inspection header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.application-build-inspection p { margin: 0; color: var(--muted); font-size: 11px; }
.application-build-inspection pre {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  border-radius: 7px;
  padding: 8px;
  background: rgba(0,0,0,.18);
  color: var(--muted);
  font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
}


/* ---------------- Application Builder controls ---------------- */
.application-builder-dialog {
  width: min(1280px, calc(100vw - 24px));
  max-width: none;
  height: min(880px, calc(var(--visual-height, 100vh) - 24px));
  max-height: none;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0,0,0,.58);
}
.application-builder-shell {
  display: grid;
  height: 100%;
  grid-template-rows: auto auto minmax(0, 1fr);
}
.application-builder-header {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}
.application-builder-header h2 { margin: 0; font-size: 19px; }
.application-builder-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.application-builder-header > div:last-child {
  display: flex;
  align-items: center;
  gap: 8px;
}
.application-builder-header select {
  min-width: 220px;
  min-height: 38px;
}
.application-builder-tabs {
  display: flex;
  min-height: 46px;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 6px 10px;
  overflow-x: auto;
}
.application-builder-tabs button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.application-builder-tabs button:hover,
.application-builder-tabs button.active {
  border-color: rgba(141,162,255,.24);
  background: rgba(141,162,255,.1);
  color: var(--text);
}
.application-builder-content {
  min-height: 0;
  padding: 16px;
  overflow: auto;
}
.application-builder-section {
  display: grid;
  gap: 14px;
  max-width: 1120px;
  margin: 0 auto;
}
.application-builder-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.application-builder-section-heading h3 {
  margin: 0;
  font-size: 16px;
}
.application-builder-section-heading p {
  max-width: 760px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.application-builder-palette,
.application-component-palette {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 8px;
}
.application-builder-palette > button,
.application-component-palette > button {
  display: grid;
  min-height: 86px;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,.025);
  color: var(--text);
  text-align: left;
}
.application-builder-palette > button:hover,
.application-component-palette > button:hover {
  border-color: rgba(141,162,255,.38);
  background: rgba(141,162,255,.08);
}
.application-builder-palette strong,
.application-component-palette strong { font-size: 13px; }
.application-builder-palette span,
.application-component-palette span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.application-component-category {
  display: grid;
  gap: 8px;
}
.application-component-category h4 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.application-component-create {
  display: flex;
  gap: 8px;
}
.application-component-create input { min-width: 220px; flex: 1; }
.application-reusable-list,
.application-state-variable-list,
.application-route-list,
.application-accessibility-list {
  display: grid;
  gap: 8px;
}
.application-reusable-list > article {
  display: grid;
  grid-template-columns: minmax(160px, .8fr) minmax(260px, 1.4fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,.025);
}
.application-reusable-list > article > div:first-child {
  display: grid;
  gap: 4px;
}
.application-reusable-list small { color: var(--muted); font-size: 10px; }
.application-reusable-list label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}
.application-reusable-list textarea {
  min-height: 72px;
  font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.application-reusable-list > article > div:last-child {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}
.application-state-variable-list > article {
  display: grid;
  grid-template-columns: 1fr 1fr 150px minmax(220px, 1.4fr) auto;
  align-items: end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,.025);
}
.application-state-variable-list label,
.application-route-list label,
.application-builder-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}
.application-state-variable-list textarea {
  min-height: 38px;
  max-height: 72px;
  font: 10px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.application-route-list > article {
  display: grid;
  grid-template-columns: minmax(180px, .6fr) minmax(280px, 1.4fr) auto;
  align-items: end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(255,255,255,.025);
}
.application-builder-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.application-token-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px;
}
.application-token-grid label {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  color: var(--muted);
  font-size: 10px;
  background: rgba(255,255,255,.02);
}
.application-token-grid input[type="color"] {
  width: 100%;
  min-height: 38px;
  padding: 2px;
}
.application-theme-preview {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: space-between;
  gap: var(--app-space-4, 16px);
  border: 1px solid var(--app-color-border, #cbd5e1);
  border-radius: var(--app-radius-large, 18px);
  padding: var(--app-space-5, 24px);
  background: var(--app-color-background, #f8fafc);
  color: var(--app-color-text, #111827);
  font-family: var(--app-font-family, system-ui, sans-serif);
}
.application-theme-preview > div { display: grid; gap: var(--app-space-2, 8px); }
.application-theme-preview span { color: var(--app-color-muted, #64748b); font-size: 12px; }
.application-theme-preview button {
  min-height: 44px;
  border: 0;
  border-radius: var(--app-radius-small, 8px);
  padding: 0 var(--app-space-4, 16px);
  background: var(--app-color-primary, #5b6ee1);
  color: var(--app-color-primary-text, #fff);
  font-weight: 700;
}
.application-accessibility-score {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 800;
}
.application-accessibility-score.valid { background: rgba(74,222,128,.1); color: #86efac; }
.application-accessibility-score.invalid { background: rgba(248,113,113,.1); color: #fca5a5; }
.application-accessibility-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.application-accessibility-summary article {
  display: grid;
  min-height: 76px;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.application-accessibility-summary strong { font-size: 24px; }
.application-accessibility-summary span { color: var(--muted); font-size: 10px; }
.application-accessibility-list article {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px;
}
.application-accessibility-list article.blocking { border-color: rgba(248,113,113,.36); }
.application-accessibility-list article.warning { border-color: rgba(250,204,21,.28); }
.application-accessibility-list article > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.application-accessibility-list p { margin: 0; font-size: 11px; }
.application-accessibility-list small,
.application-accessibility-list article > div span { color: var(--muted); font-size: 10px; }
.application-accessibility-pass {
  display: grid;
  min-height: 160px;
  place-content: center;
  gap: 7px;
  border: 1px solid rgba(74,222,128,.26);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}
.application-accessibility-pass strong { color: #86efac; }
.application-builder-empty {
  display: grid;
  min-height: 140px;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}
.application-interaction-inspector textarea {
  min-height: 92px;
  font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.application-interaction-inspector label {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}
.application-inspector-error {
  min-height: 16px;
  margin: 5px 0;
  color: #fca5a5;
  font-size: 10px;
}

/* Interactive Preview inspector */
.application-preview-dialog-inspectable .application-preview-shell {
  grid-template-rows: auto minmax(0, 1fr);
}
.application-preview-workspace {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 320px;
}
.application-preview-dialog.preview-inspector-collapsed .application-preview-workspace {
  grid-template-columns: minmax(0, 1fr) 0;
}
.application-preview-dialog.preview-inspector-collapsed .application-preview-inspector {
  display: none;
}
.application-preview-inspector {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  border-left: 1px solid var(--line);
  background: rgba(0,0,0,.1);
}
.application-preview-inspector > nav {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding: 6px;
  overflow-x: auto;
}
.application-preview-inspector > nav button {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  padding: 0 9px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.application-preview-inspector > nav button.active {
  background: rgba(141,162,255,.12);
  color: var(--text);
}
.application-preview-inspector > section {
  min-height: 0;
  padding: 10px;
  overflow: auto;
}
.preview-inspector-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}
.preview-inspector-heading strong { font-size: 12px; }
.preview-inspector-heading span { color: var(--muted); font: 10px/1.3 ui-monospace, monospace; }
.preview-route-list {
  display: grid;
  gap: 4px;
}
.preview-route-list button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: rgba(255,255,255,.02);
  color: var(--muted);
  font: 10px/1.3 ui-monospace, monospace;
  text-align: left;
}
.preview-route-list button.active {
  border-color: rgba(141,162,255,.35);
  background: rgba(141,162,255,.1);
  color: var(--text);
}
.application-preview-inspector dl {
  display: grid;
  gap: 5px;
  margin: 12px 0 0;
}
.application-preview-inspector dl > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}
.application-preview-inspector dt { color: var(--muted); font-size: 10px; }
.application-preview-inspector dd { margin: 0; font: 10px/1.3 ui-monospace, monospace; }
.preview-state-list {
  display: grid;
  gap: 7px;
  margin-bottom: 9px;
}
.preview-state-list label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font: 10px/1.3 ui-monospace, monospace;
}
.preview-state-list textarea {
  min-height: 56px;
  font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.application-preview-inspector article {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 3px 8px;
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
}
.application-preview-inspector article strong { font-size: 10px; }
.application-preview-inspector article span,
.application-preview-inspector article small { color: var(--muted); font-size: 9px; }
.application-preview-inspector article small { grid-column: 1 / -1; }
.application-preview-inspector pre {
  margin: 0;
  color: var(--muted);
  font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
}

@media (max-width: 1000px), (any-pointer: coarse) and (max-width: 1180px) {
  .application-builder-dialog {
    width: calc(100vw - max(12px, var(--safe-left)) - max(12px, var(--safe-right)));
    height: calc(var(--visual-height, 100vh) - max(12px, var(--safe-top)) - max(12px, var(--safe-bottom)));
  }
  .application-builder-tabs button,
  .application-component-palette button,
  .application-builder-palette button,
  .application-builder-footer button,
  .application-component-create button {
    min-height: 44px;
  }
  .application-builder-palette,
  .application-component-palette { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .application-token-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
  .application-state-variable-list > article {
    grid-template-columns: 1fr 1fr 140px;
  }
  .application-state-variable-list > article label:nth-of-type(4) { grid-column: 1 / span 2; }
  .application-reusable-list > article { grid-template-columns: 1fr 1.4fr; }
  .application-reusable-list > article > div:last-child { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 760px) {
  .application-builder-header {
    align-items: stretch;
    flex-direction: column;
  }
  .application-builder-header > div:last-child { justify-content: space-between; }
  .application-builder-header select { min-width: 0; flex: 1; }
  .application-builder-palette,
  .application-component-palette,
  .application-token-grid { grid-template-columns: 1fr; }
  .application-builder-section-heading,
  .application-theme-preview { align-items: stretch; flex-direction: column; }
  .application-state-variable-list > article,
  .application-route-list > article,
  .application-reusable-list > article { grid-template-columns: 1fr; }
  .application-state-variable-list > article label:nth-of-type(4),
  .application-reusable-list > article > div:last-child { grid-column: auto; }
  .application-accessibility-summary { grid-template-columns: 1fr; }
  .application-preview-workspace { grid-template-columns: minmax(0, 1fr); }
  .application-preview-inspector {
    position: absolute;
    inset: 62px 0 0 auto;
    z-index: 20;
    width: min(360px, 92vw);
    box-shadow: -12px 0 40px rgba(0,0,0,.35);
  }
}

/* ---------------- Lattice 0.23 Application Builder workspace ---------------- */
.application-builder-dialog {
  width: 100vw;
  max-width: none;
  height: var(--visual-height, 100vh);
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  background: #0b0f17;
  color: var(--text);
}
.application-builder-dialog::backdrop { background: rgba(2, 6, 15, .82); backdrop-filter: blur(8px); }
.application-builder-shell { display: grid; height: 100%; min-height: 0; grid-template-rows: 58px minmax(0,1fr) 30px; }
.application-builder-header {
  display: grid;
  grid-template-columns: auto minmax(180px, 280px) auto minmax(120px, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  background: rgba(10,14,22,.96);
}
.application-builder-brand { display: flex; align-items: center; gap: 9px; min-width: 178px; }
.application-builder-brand > div { display: grid; gap: 1px; }
.application-builder-brand strong { font-size: 13px; }
.application-builder-brand small { color: var(--muted); font-size: 9px; }
.application-builder-mark { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: linear-gradient(145deg,#8da2ff,#6458e8); color: white; font-weight: 900; box-shadow: 0 8px 24px rgba(100,88,232,.28); }
.application-builder-header select { min-width: 0; height: 38px; }
.application-builder-device-switch { display: inline-flex; gap: 2px; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: rgba(255,255,255,.025); }
.application-builder-device-switch button { min-height: 30px; border: 0; border-radius: 7px; padding: 0 9px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 750; }
.application-builder-device-switch button.active { background: rgba(141,162,255,.16); color: #dbe2ff; }
.application-builder-status { justify-self: end; display: grid; min-width: 120px; gap: 1px; text-align: right; }
.application-builder-status span { font-size: 11px; font-weight: 800; }
.application-builder-status small { color: var(--muted); font-size: 9px; }
.application-builder-status.valid span { color: #86efac; }
.application-builder-status.invalid span { color: #fca5a5; }
.application-builder-workspace { display: grid; min-width: 0; min-height: 0; grid-template-columns: 272px minmax(420px,1fr) 340px; }
.application-builder-left, .application-builder-right { min-width: 0; min-height: 0; background: rgba(8,12,19,.98); }
.application-builder-left { display: grid; grid-template-rows: auto minmax(0,1fr); border-right: 1px solid var(--line); }
.application-builder-right { border-left: 1px solid var(--line); padding: 12px; overflow: auto; }
.application-builder-center { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #111724; }
.application-builder-modes { display: grid; grid-template-columns: repeat(4,1fr); gap: 2px; border-bottom: 1px solid var(--line); padding: 6px; }
.application-builder-modes button { min-width: 0; min-height: 38px; border: 0; border-radius: 8px; padding: 0 4px; background: transparent; color: var(--muted); }
.application-builder-modes button span { display: block; font-size: 9px; font-weight: 800; }
.application-builder-modes button small { display: none; }
.application-builder-modes button.active { background: rgba(141,162,255,.14); color: #dbe2ff; }
.application-builder-left-content { display: flex; min-height: 0; flex-direction: column; overflow: auto; }
.application-builder-left-section { display: grid; gap: 8px; border-bottom: 1px solid var(--line); padding: 11px; }
.application-builder-left-section.grow { min-height: 190px; }
.application-builder-section-title, .application-builder-properties-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.application-builder-section-title strong { font-size: 10px; }
.application-builder-section-title span, .application-builder-section-title button { color: var(--muted); font-size: 9px; }
.application-builder-section-title button { border: 0; background: transparent; }
.application-builder-template-grid, .application-builder-palette { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; }
.application-builder-template-grid button, .application-builder-palette button { min-width: 0; min-height: 48px; border: 1px solid var(--line); border-radius: 9px; padding: 7px; background: rgba(255,255,255,.025); color: var(--text); text-align: left; }
.application-builder-template-grid button:hover, .application-builder-palette button:hover, .application-builder-palette button.active { border-color: rgba(141,162,255,.5); background: rgba(141,162,255,.1); }
.application-builder-template-grid strong, .application-builder-palette span { display: block; font-size: 9px; }
.application-builder-template-grid span, .application-builder-palette small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.application-builder-pages, .application-builder-layers { display: grid; gap: 3px; }
.application-builder-pages button, .application-builder-layers button, .application-builder-phase-links button { display: grid; min-width: 0; min-height: 34px; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px; border: 0; border-radius: 7px; padding: 5px 7px; background: transparent; color: var(--muted); text-align: left; }
.application-builder-layers button { padding-left: calc(7px + var(--layer-depth) * 13px); }
.application-builder-pages button:hover, .application-builder-layers button:hover, .application-builder-pages button.active, .application-builder-layers button.active, .application-builder-phase-links button.active { background: rgba(141,162,255,.11); color: var(--text); }
.application-builder-pages span, .application-builder-layers span { overflow: hidden; font-size: 9px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.application-builder-pages small, .application-builder-layers small { color: var(--muted); font-size: 7px; }
.application-builder-search { width: 100%; min-height: 32px; }
.application-builder-empty-small { margin: 5px 0; color: var(--muted); font-size: 9px; text-align: center; }
.application-builder-stage-toolbar { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 7px 12px; background: rgba(8,12,19,.8); }
.application-builder-breadcrumb { display: flex; min-width: 0; align-items: center; gap: 7px; font-size: 10px; }
.application-builder-breadcrumb span { color: var(--muted); }
.application-builder-breadcrumb strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.application-builder-placement-message { display: flex; align-items: center; gap: 8px; border: 1px solid rgba(141,162,255,.35); border-radius: 999px; padding: 5px 8px 5px 11px; background: rgba(83,98,196,.18); color: #dbe2ff; font-size: 9px; }
.application-builder-placement-message button { border: 0; background: transparent; color: #b9c4ff; font-size: 9px; }
.application-builder-stage-scroll { position: absolute; inset: 45px 0 0; overflow: auto; padding: 34px; }
.application-builder-device-frame { width: min(var(--device-width), calc(100% - 16px)); min-height: 650px; margin: 0 auto; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; overflow: hidden; background: #f5f7fb; box-shadow: 0 24px 80px rgba(0,0,0,.36); transition: width .18s ease; }
.application-builder-device-frame.device-phone { min-height: 720px; border-radius: 28px; }
.application-builder-device-bar { display: flex; height: 30px; align-items: center; gap: 5px; border-bottom: 1px solid #d8dde8; padding: 0 10px; background: #eef1f6; color: #677083; }
.application-builder-device-bar i { width: 7px; height: 7px; border-radius: 50%; background: #c4cad6; }
.application-builder-device-bar span { margin-left: 5px; font-size: 8px; }
.application-builder-stage { display: grid; min-height: 620px; align-content: start; gap: 16px; padding: 24px; color: #172033; }
.application-builder-node { position: relative; display: grid; min-width: 0; gap: 8px; border: 1px solid rgba(71,85,105,.22); border-radius: 12px; padding: 10px; background: rgba(255,255,255,.78); cursor: pointer; box-shadow: 0 3px 14px rgba(15,23,42,.045); }
.application-builder-node:hover { border-color: rgba(79,70,229,.45); }
.application-builder-node.selected { outline: 2px solid #6366f1; outline-offset: 2px; }
.application-builder-node.placement-target { border: 2px dashed #6366f1; background: rgba(99,102,241,.08); animation: builder-placement-pulse 1.2s infinite alternate; }
@keyframes builder-placement-pulse { to { box-shadow: 0 0 0 5px rgba(99,102,241,.1); } }
.application-builder-node.type-application-root { border: 0; padding: 4px; background: transparent; box-shadow: none; }
.application-builder-object-chrome { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #7c8799; font-size: 7px; text-transform: uppercase; letter-spacing: .05em; }
.application-builder-object-chrome code { font-size: 7px; text-transform: none; }
.application-builder-object-preview { min-height: 28px; pointer-events: none; }
.application-builder-children { display: grid; gap: 12px; padding: 4px; }
.type-app-layout > .application-builder-children { grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); }
.application-builder-object-preview button { min-height: 38px; border: 0; border-radius: 9px; padding: 0 15px; background: #4f46e5; color: white; font-weight: 750; }
.application-builder-object-preview label { display: grid; gap: 5px; color: #475569; font-size: 9px; }
.application-builder-object-preview input { min-height: 36px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; }
.application-builder-object-preview nav { display: flex; gap: 18px; border-bottom: 1px solid #dbe1ea; padding: 10px 4px; font-size: 10px; font-weight: 700; }
.builder-root-label, .builder-layout-label, .builder-generic, .builder-form, .builder-modal, .builder-status { display: grid; gap: 3px; }
.builder-root-label strong { font-size: 18px; }
.builder-root-label span, .builder-layout-label span, .builder-generic span, .builder-form span, .builder-modal span, .builder-status span { color: #64748b; font-size: 9px; }
.builder-chart { display: flex; min-height: 160px; align-items: end; gap: 10px; border-radius: 10px; padding: 14px; background: linear-gradient(180deg,#f8fafc,#eef2ff); }
.builder-chart strong { align-self: start; margin-right: auto; font-size: 11px; }
.builder-chart i { width: 13%; height: var(--h); border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg,#818cf8,#4f46e5); }
.builder-table { display: grid; gap: 6px; }
.builder-table i { height: 20px; border-radius: 5px; background: #eef2f7; }
.builder-kanban > div { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 8px; }
.builder-kanban i { min-height: 100px; border-radius: 8px; background: #eef2f7; }
.builder-tabs { display: flex; gap: 16px; border-bottom: 1px solid #dbe1ea; padding: 8px 2px; font-size: 9px; font-weight: 700; }
.application-builder-properties-heading { margin-bottom: 12px; }
.application-builder-properties-heading > div { display: grid; gap: 2px; }
.application-builder-properties-heading strong { font-size: 12px; }
.application-builder-properties-heading span { color: var(--muted); font-size: 9px; }
.application-builder-properties-heading button { border: 0; background: transparent; color: #aab7ff; font-size: 8px; }
.application-builder-property-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin-bottom: 9px; }
.application-builder-property-grid label { display: grid; gap: 4px; color: var(--muted); font-size: 8px; }
.application-builder-property-grid label:first-child, .application-builder-property-grid label:nth-child(2), .application-builder-property-grid label:nth-child(3) { grid-column: 1 / -1; }
.application-builder-inspector-section { display: grid; gap: 8px; border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.application-builder-action-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 7px; }
.application-builder-action-row > div { display: grid; gap: 1px; }
.application-builder-action-row strong { font-size: 8px; }
.application-builder-action-row span, .application-builder-action-row code { color: var(--muted); font-size: 7px; }
.application-builder-action-row button { width: 24px; height: 24px; border: 0; border-radius: 6px; background: rgba(248,113,113,.08); color: #fca5a5; }
.application-builder-action-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.application-builder-action-builder input:last-of-type, .application-builder-action-builder button { grid-column: 1 / -1; }
.application-builder-advanced { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.application-builder-advanced summary { color: var(--muted); font-size: 9px; cursor: pointer; }
.application-builder-advanced textarea { width: 100%; min-height: 180px; margin: 8px 0; font: 9px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace; }
.application-builder-tool-tabs { display: flex; min-height: 46px; gap: 4px; border-bottom: 1px solid var(--line); padding: 7px 10px; background: rgba(8,12,19,.8); overflow-x: auto; }
.application-builder-tool-tabs button { min-height: 31px; border: 0; border-radius: 8px; padding: 0 11px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 750; }
.application-builder-tool-tabs button.active { background: rgba(141,162,255,.14); color: #dbe2ff; }
.application-builder-tool-content { position: absolute; inset: 46px 0 0; padding: 18px; overflow: auto; }
.application-builder-tool-content .application-builder-section { max-width: 1100px; margin: 0 auto; }
.application-builder-phase-intro, .application-builder-guide { display: grid; gap: 6px; padding: 13px; }
.application-builder-phase-intro strong, .application-builder-guide strong { font-size: 12px; }
.application-builder-phase-intro span, .application-builder-guide p, .application-builder-guide li { color: var(--muted); font-size: 9px; line-height: 1.5; }
.application-builder-phase-links { display: grid; gap: 3px; padding: 0 8px; }
.application-builder-release-card { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.application-builder-release-card > strong, .application-builder-release-card > button { grid-column: 1 / -1; }
.application-builder-release-card > div { display: grid; min-height: 72px; place-content: center; gap: 2px; border: 1px solid var(--line); border-radius: 10px; text-align: center; }
.application-builder-release-card b { font-size: 22px; }
.application-builder-release-card span { color: var(--muted); font-size: 8px; }
.application-builder-empty { display: grid; min-height: 100%; place-content: center; gap: 7px; padding: 30px; color: var(--muted); text-align: center; }
.application-builder-empty strong { color: var(--text); font-size: 16px; }
.application-builder-empty span { max-width: 440px; font-size: 10px; }
.application-builder-footer { display: flex; align-items: center; gap: 18px; border-top: 1px solid var(--line); padding: 0 12px; background: #080c13; color: var(--muted); font-size: 8px; }
.application-builder-footer span:last-child { margin-left: auto; }

@media (max-width: 1180px) {
  .application-builder-workspace { grid-template-columns: 236px minmax(380px,1fr) 300px; }
  .application-builder-header { grid-template-columns: auto minmax(150px,1fr) auto auto auto; }
  .application-builder-device-switch, .application-builder-status { display: none; }
}
@media (max-width: 860px) {
  .application-builder-workspace { grid-template-columns: 210px minmax(0,1fr); }
  .application-builder-right { position: absolute; z-index: 30; inset: 58px 0 30px auto; width: min(340px,88vw); box-shadow: -18px 0 50px rgba(0,0,0,.42); }
  .application-builder-header { grid-template-columns: auto minmax(0,1fr) auto auto; }
  .application-builder-header [data-builder-preview] { display: none; }
  .application-builder-brand small { display: none; }
}

/* Lattice 0.24 tablet-first Canvas and document interaction overhaul. */
.canvas-add-button {
  display: none;
  position: absolute;
  left: calc(12px + var(--safe-left));
  bottom: calc(var(--bottom) + 14px + var(--safe-bottom));
  z-index: 38;
  min-width: 72px;
  height: 52px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 16px;
  color: #fff;
  background: rgba(91,111,224,.96);
  box-shadow: 0 14px 38px rgba(0,0,0,.36);
  font-weight: 750;
}
.canvas-add-button > span:first-child { font-size: 22px; line-height: 1; }
.canvas-add-sheet {
  position: absolute;
  left: max(10px, var(--safe-left));
  right: max(10px, var(--safe-right));
  bottom: calc(var(--bottom) + max(10px, var(--safe-bottom)));
  z-index: 92;
  max-height: min(78vh, 720px);
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  background: rgba(18,24,38,.985);
  box-shadow: 0 24px 80px rgba(0,0,0,.58);
  backdrop-filter: blur(20px);
  overscroll-behavior: contain;
}
.canvas-add-sheet[hidden] { display: none !important; }
.canvas-add-sheet > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.canvas-add-sheet > header div { display: grid; gap: 3px; }
.canvas-add-sheet > header strong { font-size: 17px; }
.canvas-add-sheet > header small { color: var(--muted); }
.canvas-add-section + .canvas-add-section { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.canvas-add-section h3 { margin: 0 0 8px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.canvas-add-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; }
.canvas-add-grid button,
.canvas-add-list button {
  min-height: 58px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255,255,255,.045);
}
.canvas-add-grid button { display: grid; place-items: center; align-content: center; gap: 5px; padding: 8px; }
.canvas-add-list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.canvas-add-grid button:active,
.canvas-add-list button:active { transform: scale(.985); background: rgba(109,140,255,.16); }
.shape-glyph { display: block; width: 25px; height: 19px; border: 2px solid #dce5ff; }
.shape-glyph.ellipse { border-radius: 50%; }
.shape-glyph.triangle { width: 0; height: 0; border: 0; border-left: 13px solid transparent; border-right: 13px solid transparent; border-bottom: 22px solid #dce5ff; }
.shape-glyph.diamond { width: 18px; height: 18px; transform: rotate(45deg); }
.shape-glyph.line { width: 28px; height: 0; border-width: 2px 0 0; transform: rotate(-20deg); }
.shape-glyph.arrow,
.shape-glyph.pen,
.shape-glyph.lasso { width: auto; height: auto; border: 0; font-size: 22px; }

.canvas-selection-bar {
  position: absolute;
  left: 50%;
  bottom: calc(var(--bottom) + 14px + var(--safe-bottom));
  z-index: 41;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  background: rgba(18,24,38,.97);
  box-shadow: 0 14px 42px rgba(0,0,0,.42);
  backdrop-filter: blur(16px);
}
.canvas-selection-bar[hidden] { display: none !important; }
.canvas-selection-bar button {
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text);
  background: rgba(255,255,255,.055);
}
.canvas-selection-bar button.danger { color: #ffd6d9; background: rgba(196,60,72,.22); }
.canvas-selection-count { padding: 0 8px; color: var(--muted); font-size: 11px; white-space: nowrap; }

html.has-touch .canvas-add-button,
html.has-pen .canvas-add-button,
body[data-layout="compact"] .canvas-add-button,
body[data-layout="medium"] .canvas-add-button { display: inline-flex; }
html.has-touch .canvas-status,
html.has-pen .canvas-status,
body[data-layout="compact"] .canvas-status,
body[data-layout="medium"] .canvas-status { left: 96px; }
html.has-touch .canvas-toolbar .toolbar-content { overflow-x: auto; overflow-y: visible; }
html.has-touch .canvas-toolbar { overflow: visible; }
html.has-touch .canvas-toolbar .toolbar-menu {
  position: fixed;
  top: calc(var(--topbar) + var(--safe-top) + 6px);
  left: 50%;
  width: min(320px, calc(100vw - 20px));
  transform: translateX(-50%);
}
html.has-touch .canvas-stage:fullscreen .focus-exit,
html.has-touch body.canvas-focus .focus-exit,
html.has-pen .canvas-stage:fullscreen .focus-exit,
html.has-pen body.canvas-focus .focus-exit { display: none; }
body.canvas-focus .canvas-add-button { bottom: calc(14px + var(--safe-bottom)); }
body.canvas-focus .canvas-add-sheet { bottom: max(10px, var(--safe-bottom)); }
body.canvas-focus .canvas-selection-bar { bottom: calc(14px + var(--safe-bottom)); }
body.canvas-focus.ui-hidden .canvas-add-button,
body.canvas-focus.ui-hidden .canvas-selection-bar { opacity: .18; }
body.canvas-focus.ui-hidden .canvas-add-sheet { display: none !important; }

html.has-touch .block { padding-left: 54px; }
html.has-touch .block-action-handle {
  left: 4px;
  top: 4px;
  width: 44px;
  height: 44px;
  opacity: 1;
  touch-action: none;
}
body.keyboard-open .editor-toolbar {
  position: fixed;
  top: auto;
  bottom: calc(var(--keyboard-offset) + 8px + var(--safe-bottom));
  opacity: 1;
  pointer-events: auto;
  z-index: 70;
}

@media (max-width: 760px) {
  .canvas-add-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .canvas-add-list { grid-template-columns: 1fr; }
  .canvas-selection-bar { max-width: calc(100vw - 20px); }
  .canvas-selection-count { display: none; }
  .canvas-selection-bar button { padding-inline: 10px; }
}


/* Lattice 0.25 startup observability, vector gestures, and adaptive inspector. */
.startup-status {
  position: fixed; inset: 0; z-index: 10000; display: grid; place-content: center;
  grid-template-columns: auto minmax(0, 320px); align-items: center; gap: 14px;
  padding: 24px; color: var(--text, #eef2ff); background: #0c1019;
  transition: opacity .14s ease;
}
.startup-status[hidden] { display: none !important; }
.startup-status.is-ready { opacity: 0; pointer-events: none; }
.startup-status.is-error { background: #1a1014; }
.startup-status img { filter: drop-shadow(0 8px 24px rgba(109,140,255,.4)); }
.startup-status div { display: grid; gap: 4px; }
.startup-status strong { font-size: 16px; }
.startup-status span { color: #9aa6bd; font-size: 12px; }
.path-node-hit, .path-handle-hit { fill: transparent; stroke: none; pointer-events: all; cursor: grab; }
.path-node-hit:active, .path-handle-hit:active { cursor: grabbing; }
body.node-editing .selection-box { stroke-dasharray: 3 5; opacity: .62; }
body.node-editing .resize-handle, body.node-editing .resize-handle-hit { display: none; }

/* The floating Add affordance is a compact-layout replacement, not a duplicate toolbar. */
html.has-touch .canvas-add-button,
html.has-pen .canvas-add-button,
body[data-layout="medium"] .canvas-add-button { display: none; }
body[data-layout="compact"] .canvas-add-button,
html.has-touch body[data-layout="medium"] .canvas-add-button,
html.has-pen body[data-layout="medium"] .canvas-add-button { display: inline-flex; }

@media (min-width: 900px) {
  .canvas-inspector {
    top: 48px; right: 8px; bottom: auto; left: auto; width: min(330px, 31vw);
    height: auto !important; max-height: calc(100% - 94px); overflow: auto;
  }
  .canvas-inspector .inspector-sheet-handle { display: none !important; }
}
@media (max-width: 899px) {
  html.has-touch .canvas-inspector, html.has-pen .canvas-inspector {
    top: auto; right: 6px; bottom: calc(var(--bottom) + 6px); left: 6px; width: auto;
    max-height: min(78vh, 760px);
  }
  html.has-touch .canvas-inspector .inspector-sheet-handle,
  html.has-pen .canvas-inspector .inspector-sheet-handle { display: block; }
}
@media (prefers-reduced-motion: reduce) { .startup-status { transition: none; } }

/* 0.26 presentation experience */
.presentation-panel[hidden],
.presentation-hud[hidden],
.presentation-invitation[hidden] { display: none !important; }
.presentation-hud {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 160ms ease, transform 160ms ease;
}
body.presentation-controls-visible .presentation-hud {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.presentation-invitation {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 125;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 8px 9px 8px 12px;
  border: 1px solid rgba(141,162,255,.42);
  border-radius: 999px;
  background: rgba(11,18,32,.96);
  box-shadow: 0 12px 36px rgba(0,0,0,.36);
  backdrop-filter: blur(16px);
  font-size: 12px;
}
body.presentation-following .editor-toolbar,
body.presentation-following .canvas-toolbar,
body.presentation-following .canvas-inspector,
body.presentation-following .zoom-toolbar,
body.presentation-following .canvas-add-button,
body.presentation-following .canvas-selection-bar { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .presentation-hud { transition: none; }
}
@media (max-width: 720px) {
  .presentation-invitation { width: calc(100vw - 16px); justify-content: center; border-radius: 14px; }
  .presentation-hud { left: 8px; right: 8px; width: auto; justify-content: center; transform: translateY(14px); overflow-x: auto; }
  body.presentation-controls-visible .presentation-hud { transform: translateY(0); }
}

/* ---------------- 0.27 Everyday Knowledge ---------------- */
.knowledge-top-action svg { fill: none; stroke: currentColor; stroke-width: 1.7; }
.sync-state { border: 0; background: transparent; cursor: pointer; }
.sync-state:hover { color: var(--text); }
.sync-state.healthy { border: 0; }
.knowledge-sidebar-result { min-height: 48px; border-radius: 8px; padding: 7px 8px; }
.knowledge-sidebar-result .document-item-text > span { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; line-height: 1.35; }
.knowledge-result-pulse { animation: knowledge-result-pulse 1.25s ease-out; }
@keyframes knowledge-result-pulse { 0% { box-shadow: 0 0 0 0 rgba(141,162,255,.75); background: rgba(100,120,232,.22); } 100% { box-shadow: 0 0 0 18px rgba(141,162,255,0); } }

.knowledge-dialog { width: min(760px, calc(100vw - 24px)); }
.knowledge-dialog .settings-form { max-height: min(760px, calc(var(--visual-height, 100vh) - 24px)); overflow: auto; }
.knowledge-dialog .settings-form > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 10px; }
.knowledge-dialog h2, .knowledge-dialog h3 { margin: 0; }
.knowledge-dialog header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.knowledge-dialog menu { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.menu-spacer { flex: 1; }
.quick-capture-dialog { width: min(580px, calc(100vw - 20px)); }
.quick-capture-dialog textarea { min-height: 180px; margin: 2px 20px 12px; width: calc(100% - 40px); resize: vertical; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: 14px; font-size: 16px; line-height: 1.55; outline: 0; }
.quick-capture-dialog textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(141,162,255,.12); }
.knowledge-dialog-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px 14px; }
.knowledge-dialog-options label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.knowledge-dialog-options select { min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 6px 9px; }

.knowledge-search-dialog { width: min(720px, calc(100vw - 20px)); padding: 0; }
.knowledge-search-form { display: grid; grid-template-rows: auto auto minmax(120px, 520px) auto; max-height: min(720px, calc(var(--visual-height, 100vh) - 20px)); }
.knowledge-search-form > header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.knowledge-search-form > header input { flex: 1; min-height: 48px; border: 0; outline: 0; background: transparent; font-size: 17px; }
.knowledge-search-summary { padding: 8px 15px; color: var(--muted); font-size: 11px; border-bottom: 1px solid rgba(255,255,255,.05); }
.knowledge-search-results { overflow: auto; padding: 7px; }
.knowledge-search-result { width: 100%; min-height: 62px; display: grid; grid-template-columns: 110px minmax(0,1fr); grid-template-rows: auto auto; gap: 2px 10px; border: 0; border-radius: 10px; padding: 9px 11px; background: transparent; text-align: left; }
.knowledge-search-result:hover, .knowledge-search-result:focus-visible { background: var(--panel-3); outline: 0; }
.knowledge-search-kind { grid-row: 1 / 3; align-self: center; color: var(--accent); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.knowledge-search-result strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.knowledge-search-snippet { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-search-empty { padding: 44px 18px; text-align: center; color: var(--muted); }
.knowledge-search-form > footer { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.knowledge-search-form > footer span { margin-right: 8px; }
.knowledge-search-form kbd { color: var(--muted); font: 11px/1 ui-monospace, monospace; }

.template-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 8px 20px 18px; overflow: auto; }
.template-card { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 10px; min-height: 132px; border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: rgba(255,255,255,.025); }
.template-card:hover { border-color: var(--line-strong); background: rgba(255,255,255,.04); }
.template-card-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: rgba(100,120,232,.15); color: #cbd4ff; font-size: 18px; }
.template-card strong { display: block; font-size: 13px; }
.template-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.template-card-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; align-self: end; }

.backlinks-panel { max-width: 880px; margin: -80px auto 100px; padding: 0 58px; }
.backlinks-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.backlinks-panel > header > div { display: flex; align-items: center; gap: 7px; }
.backlinks-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.backlink-section { min-width: 0; border: 1px solid var(--line); border-radius: 11px; padding: 9px; background: rgba(255,255,255,.018); }
.backlink-section h4 { margin: 0 0 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.backlink-section p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.backlink-result { width: 100%; display: grid; gap: 3px; border: 0; border-radius: 7px; padding: 7px; background: transparent; text-align: left; }
.backlink-result:hover, .backlink-result:focus-visible { background: var(--panel-3); outline: 0; }
.backlink-result strong { font-size: 11px; }
.backlink-result span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.block-table { padding-right: 42px; }
.knowledge-table-shell { display: grid; gap: 7px; margin: 5px 0; }
.knowledge-table-scroll { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.knowledge-table { width: 100%; min-width: 420px; border-collapse: collapse; table-layout: fixed; }
.knowledge-table th, .knowledge-table td { min-width: 120px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0; vertical-align: top; }
.knowledge-table th { background: var(--panel-2); }
.knowledge-table tr:last-child td { border-bottom: 0; }
.knowledge-table th:last-child, .knowledge-table td:last-child { border-right: 0; }
.knowledge-table-header, .knowledge-table-cell { min-height: 38px; padding: 9px 10px; outline: 0; line-height: 1.35; }
.knowledge-table-header { color: #d6ddec; font-size: 11px; font-weight: 750; }
.knowledge-table-cell { color: var(--text); font-size: 12px; }
.knowledge-table-header:focus, .knowledge-table-cell:focus { background: rgba(100,120,232,.1); box-shadow: inset 0 0 0 2px rgba(141,162,255,.42); }
.knowledge-table-row-action { width: 38px !important; min-width: 38px !important; text-align: center; }
.knowledge-table-row-action .icon-button { min-width: 30px; width: 30px; height: 30px; color: var(--muted); }
.knowledge-table-controls { display: flex; gap: 6px; }

.sync-center-dialog { width: min(820px, calc(100vw - 20px)); }
.sync-center-hero { display: grid; gap: 5px; margin: 2px 20px 14px; border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: linear-gradient(135deg, rgba(88,211,155,.1), rgba(100,120,232,.08)); }
.sync-center-hero strong { font-size: 16px; }
.sync-center-hero span { color: var(--muted); font-size: 12px; }
.sync-center-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; padding: 0 20px 14px; }
.sync-center-grid section { display: grid; gap: 5px; min-height: 74px; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); }
.sync-center-grid span { color: var(--muted); font-size: 10px; }
.sync-center-grid strong { font-size: 12px; overflow-wrap: anywhere; }

.sync-center-failure { display: grid; gap: 6px; margin: 0 20px 14px; border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line)); border-radius: 11px; padding: 12px; background: color-mix(in srgb, var(--danger) 7%, var(--bg)); }
.sync-center-failure[hidden] { display: none; }
.sync-center-failure > span { color: var(--muted); font-size: 12px; }
.sync-center-failure details { font-size: 11px; color: var(--muted); }
.sync-center-failure pre { max-height: 150px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.sync-center-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px 18px; }
.sync-center-columns > section { border: 1px solid var(--line); border-radius: 11px; padding: 10px; }
.sync-center-columns h3 { margin: 0 0 7px; font-size: 12px; }
.sync-center-list { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.sync-center-list li { display: grid; gap: 2px; min-height: 42px; border-radius: 7px; padding: 7px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 11px; }
.sync-center-list strong { color: var(--text); font-size: 11px; }

.knowledge-drop-overlay { position: fixed; inset: max(12px,var(--safe-top)) max(12px,var(--safe-right)) max(12px,var(--safe-bottom)) max(12px,var(--safe-left)); z-index: 180; display: grid; place-content: center; gap: 6px; border: 2px dashed var(--accent); border-radius: 20px; background: rgba(12,16,25,.88); backdrop-filter: blur(14px); text-align: center; pointer-events: none; }
.knowledge-drop-overlay[hidden] { display: none; }
.knowledge-drop-overlay strong { font-size: 20px; }
.knowledge-drop-overlay span { color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .backlinks-panel { padding-inline: 18px; }
  .sync-center-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .knowledge-top-action { display: none; }
  .sync-state { display: inline-flex !important; max-width: 34px; min-width: 30px; min-height: 30px; align-items: center; justify-content: center; overflow: visible; color: transparent; }
  .sync-state::before { content: '●'; color: var(--muted); font-size: 11px; }
  .sync-state.healthy::before, .sync-state.live::before, .sync-state.saved::before { color: var(--success); }
  .sync-state.offline::before, .sync-state.error::before, .sync-state.conflict::before { color: var(--danger); }
  .sync-state.saving::before, .sync-state.connecting::before, .sync-state.reconnecting::before { color: #f1c75b; }
  .template-list, .backlinks-list, .sync-center-columns { grid-template-columns: 1fr; }
  .backlinks-panel { margin-top: -82px; padding-inline: 16px; }
  .knowledge-search-result { grid-template-columns: 78px minmax(0,1fr); }
  .sync-center-grid { grid-template-columns: 1fr 1fr; }
  .knowledge-dialog menu { flex-wrap: wrap; }
  .knowledge-dialog-options { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .template-list { grid-template-columns: 1fr; padding-inline: 12px; }
  .sync-center-grid { grid-template-columns: 1fr; padding-inline: 12px; }
  .sync-center-columns { padding-inline: 12px; }
  .knowledge-search-result { grid-template-columns: 1fr; }
  .knowledge-search-kind { grid-row: auto; }
  .quick-capture-dialog textarea { margin-inline: 12px; width: calc(100% - 24px); }
  .knowledge-dialog-options { padding-inline: 12px; }
}
html.has-touch body.overlay-sidebar .bottom-nav { grid-template-columns: repeat(5,1fr); }
@media (max-width: 680px) { .bottom-nav { grid-template-columns: repeat(5,1fr); } }

.backlinks-toggle { display:flex; align-items:center; gap:7px; min-height:36px; border:0; padding:0 6px 0 0; color:var(--text); background:transparent; cursor:pointer; }
.backlinks-chevron { color:var(--muted); transition:transform .14s ease; }
.backlinks-toggle[aria-expanded="true"] .backlinks-chevron { transform:rotate(180deg); }
.backlinks-list[hidden] { display:none !important; }
.knowledge-search-result mark { padding:0; color:inherit; background:rgba(141,162,255,.28); border-radius:3px; }
.knowledge-table th { position:relative; }
.knowledge-table-column-remove { position:absolute; top:4px; right:4px; width:24px; height:24px; border:0; border-radius:6px; color:var(--muted); background:transparent; opacity:0; cursor:pointer; }
.knowledge-table th:hover .knowledge-table-column-remove, .knowledge-table th:focus-within .knowledge-table-column-remove { opacity:1; }
.knowledge-link-picker { position:fixed; z-index:260; width:min(360px,calc(100vw - 24px)); max-height:280px; overflow:auto; padding:6px; border:1px solid var(--line-strong); border-radius:11px; background:var(--panel); box-shadow:0 18px 50px rgba(0,0,0,.34); }
.knowledge-link-picker button { width:100%; min-height:42px; display:grid; gap:2px; border:0; border-radius:8px; padding:7px 9px; color:var(--text); background:transparent; text-align:left; }
.knowledge-link-picker button:hover, .knowledge-link-picker button:focus { outline:0; background:var(--panel-3); }
.knowledge-link-picker span { color:var(--muted); font-size:10px; }
.editor a[href^="lattice://document/"] { color:var(--accent); text-decoration:underline; text-decoration-color:rgba(141,162,255,.45); text-underline-offset:2px; cursor:pointer; }
@media (any-pointer:coarse) { .knowledge-table-column-remove { width:36px; height:36px; opacity:1; } }

/* Lattice 0.39 integrated AI: spatial invocation, tentative proposals, no workbench. */
.ai-panel.ai-popover {
  position: fixed;
  inset: auto;
  right: auto;
  bottom: auto;
  z-index: 82;
  transform: none;
  width: min(360px, calc(100vw - 20px));
  max-height: calc(100dvh - 24px);
  padding: 10px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--line) 76%, #8da2ff 24%);
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 96%, #7288ff 4%);
  box-shadow: 0 18px 54px rgba(0,0,0,.38), 0 0 0 1px rgba(141,162,255,.06);
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.ai-panel.ai-popover.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.ai-panel.ai-popover[hidden] { display: none !important; }
.ai-popover-header { margin-bottom: 7px; }
.ai-popover .context-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; margin-bottom: 8px; color: var(--muted); }
.ai-popover .context-chip span:last-child { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-popover .ai-section { gap: 7px; }
.ai-popover .prompt-field textarea { min-height: 76px; max-height: 170px; resize: vertical; border-radius: 10px; }
.ai-popover .ai-actions { grid-template-columns: repeat(4, minmax(0,1fr)); }
.ai-popover .ai-actions button { min-width: 0; padding: 6px 4px; font-size: 10px; }
.ai-suggest-button { border-color: rgba(141,162,255,.38) !important; background: rgba(100,120,232,.12) !important; }
.ai-compact-options { display: flex; align-items: center; gap: 7px; }
.ai-compact-options label { flex: 1; }
.ai-context-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ai-context-footer .status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-context-footer .has-memory::before { content: '• '; color: #8da2ff; }
.text-button { border: 0; background: transparent; color: var(--muted); padding: 4px 6px; cursor: pointer; }
.text-button:hover, .text-button:focus-visible { color: var(--text); }
.ai-status { min-height: 0; padding: 5px 1px 0; }
.compact-note { padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; color: var(--muted); }

.block { position: relative; }
.block-ai-handle {
  position: absolute;
  right: 35px;
  top: 5px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #8da2ff;
  opacity: 0;
  cursor: pointer;
  transition: opacity .1s ease, background .1s ease, border-color .1s ease;
}
.block:hover .block-ai-handle, .block.selected .block-ai-handle, .block-ai-handle:focus-visible { opacity: .9; }
.block-ai-handle:hover, .block-ai-handle:focus-visible { background: rgba(100,120,232,.12); border-color: rgba(141,162,255,.28); opacity: 1; }
html.has-touch .block-ai-handle { right: 43px; top: 6px; width: 34px; height: 34px; opacity: .82; touch-action: manipulation; }

.ai-inline-proposal {
  position: relative;
  margin: 8px 0 14px;
  padding: 10px 11px;
  border: 1px dashed rgba(141,162,255,.58);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(100,120,232,.08), rgba(57,198,176,.035));
  box-shadow: inset 0 0 28px rgba(100,120,232,.035);
}
.ai-inline-proposal > header { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.ai-inline-proposal header > span:last-child { display: grid; gap: 2px; }
.ai-inline-proposal header small { color: var(--muted); font-size: 11px; line-height: 1.35; }
.ai-proposal-mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; color: #a9b8ff; background: rgba(100,120,232,.12); }
.ai-inline-preview { display: grid; gap: 5px; }
.ai-ghost-block { padding: 8px 10px; border-left: 2px solid rgba(141,162,255,.55); border-radius: 5px; color: color-mix(in srgb, var(--text) 82%, #8da2ff 18%); background: rgba(255,255,255,.025); opacity: .88; }
.ai-ghost-heading { font-weight: 700; font-size: 1.05em; }
.ai-ghost-callout { background: rgba(100,120,232,.065); }
.ai-inline-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 9px; }
.ai-inline-actions button { min-height: 30px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: var(--text); }
.ai-inline-actions button.primary { background: #6478e8; border-color: #7186ee; color: white; }

#canvas-ai-proposals { pointer-events: none; }
#canvas-ai-proposals .ai-proposal-object { opacity: .58; filter: saturate(.78); }
#canvas-ai-proposals .ai-proposal-object > * { stroke-dasharray: 8 6; }
#canvas-ai-proposals .canvas-object-text > text { stroke-dasharray: none; }
.ai-proposal-controls {
  position: fixed;
  z-index: 84;
  transform: translate(-50%, 0);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 1px solid rgba(141,162,255,.35);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 95%, #6478e8 5%);
  box-shadow: 0 12px 38px rgba(0,0,0,.34);
  white-space: nowrap;
}
.ai-proposal-controls[hidden] { display: none; }
.ai-proposal-controls > span { padding: 0 5px; color: #c9d2ff; font-size: 11px; font-weight: 650; }
.ai-proposal-controls button { min-height: 29px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2); color: var(--text); }
.ai-proposal-controls button.primary { background: #6478e8; border-color: #7186ee; color: white; }
.ai-proposal-controls.thinking { pointer-events: none; opacity: .92; }
.ai-proposal-controls.thinking > span::after { content: ''; display: inline-block; width: 4px; height: 4px; margin-left: 7px; border-radius: 50%; background: currentColor; animation: ai-thinking-pulse 1s ease-in-out infinite alternate; }
@keyframes ai-thinking-pulse { from { opacity: .25; transform: scale(.7); } to { opacity: 1; transform: scale(1.2); } }
.ai-selection-action { color: #bac6ff !important; }

@media (prefers-reduced-motion: reduce) {
  .ai-panel.ai-popover, .block-ai-handle { transition: none; }
  .ai-proposal-controls.thinking > span::after { animation: none; }
}

@media (max-width: 680px) {
  .ai-panel.ai-popover { right: auto; bottom: auto; border-radius: 14px; max-height: min(58dvh, 470px); }
  .ai-popover .ai-actions { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ai-proposal-controls { max-width: calc(100vw - 16px); overflow-x: auto; }
}

html.has-touch .ai-inline-actions button,
html.has-touch .ai-proposal-controls button,
html.has-touch .ai-suggest-button,
html.has-touch #canvas-selection-ai { min-height: 44px; }
html.has-touch body.overlay-sidebar .ai-panel.ai-popover,
html.has-touch body.overlay-sidebar.keyboard-open .ai-panel.ai-popover { bottom: auto; }
.knowledge-search-why { display:block; color:var(--muted); font-size:10px; line-height:1.3; margin-top:2px; }
.knowledge-inspector-row > .button { margin-right:6px; margin-bottom:4px; }
.transfer-progress-dialog progress { width:100%; min-height:8px; }
.publication-profile-actions { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0; }
.export-preflight-dialog ul { max-height:320px; overflow:auto; padding-left:22px; }
.export-preflight-dialog li[data-severity="error"] { font-weight:700; }

.collaboration-conflict-dialog { width:min(680px,calc(100vw - 32px)); }
.collaboration-conflict-dialog section { max-height:45vh; overflow:auto; }
.collaboration-conflict-dialog pre { white-space:pre-wrap; overflow:auto; max-height:220px; }

/* Knowledge graph relation/inspector shell */
.knowledge-inspector-dialog{width:min(720px,calc(100vw - 24px));max-height:min(82vh,760px);border:1px solid var(--border);border-radius:16px;padding:0;background:var(--surface);color:var(--text);box-shadow:0 24px 70px rgba(15,23,42,.25)}
.knowledge-inspector-shell{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;max-height:min(82vh,760px)}
.knowledge-inspector-shell>header,.knowledge-inspector-shell>footer{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 14px;border-bottom:1px solid var(--border)}
.knowledge-inspector-shell>footer{border-top:1px solid var(--border);border-bottom:0}.knowledge-inspector-shell header div{display:grid;gap:2px;min-width:0}.knowledge-inspector-shell header small{color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.knowledge-inspector-actions{display:flex;gap:8px;flex-wrap:wrap;padding:10px 14px;border-bottom:1px solid var(--border)}
.knowledge-inspector-shell section[data-knowledge-inspector-body]{overflow:auto;padding:14px;display:grid;gap:14px}.knowledge-inspector-shell h3{margin:0;font-size:20px}
.knowledge-inspector-section{display:grid;gap:6px}.knowledge-relation-dialog{width:min(620px,calc(100vw - 24px));border:1px solid var(--border);border-radius:16px;padding:0;background:var(--surface);color:var(--text)}.knowledge-relation-editor{display:grid;gap:12px;padding:16px}.knowledge-relation-editor header,.knowledge-relation-editor footer{display:flex;align-items:center;justify-content:space-between;gap:10px}.knowledge-relation-editor label{display:grid;gap:6px;font-weight:650}.knowledge-relation-editor input,.knowledge-relation-editor select{width:100%;box-sizing:border-box}.knowledge-relation-targets{min-height:180px}.knowledge-relation-hint{color:var(--muted);font-size:12px}.knowledge-inspector-row{display:block;width:100%;padding:8px 10px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2);color:var(--text);text-align:left;font:inherit}.knowledge-inspector-link{cursor:pointer}.knowledge-inspector-link:hover{border-color:var(--accent)}
.knowledge-node-card{box-sizing:border-box;width:100%;height:100%;display:grid;align-content:start;gap:7px;padding:13px 14px;border:1px solid #8da2ff;border-radius:14px;background:#111827;color:#f8fafc;overflow:hidden;font-family:system-ui,sans-serif}.knowledge-node-card.is-selected{box-shadow:inset 0 0 0 2px #c7d2fe}.knowledge-node-card.is-missing{opacity:.65}.knowledge-node-card strong{font-size:15px;line-height:1.25}.knowledge-node-card small{color:#cbd5e1;line-height:1.3;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.knowledge-node-kind{justify-self:start;border-radius:999px;padding:2px 7px;background:#273449;color:#c7d2fe;font-size:10px;font-weight:750;text-transform:uppercase;letter-spacing:.04em}
@media(max-width:680px){.knowledge-inspector-dialog{width:calc(100vw - 10px);max-height:calc(100vh - 10px);border-radius:12px}.knowledge-inspector-actions .button{min-height:44px}.knowledge-inspector-row{min-height:44px}}

/* Semantic Graph Space */
.graph-view { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(circle at 50% 35%, rgba(102,118,232,.08), transparent 42%), var(--surface, #fff); }
.graph-space-shell { position: absolute; inset: 0; min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
.graph-toolbar { top: 12px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; gap: 6px; align-items: center; max-width: calc(100% - 28px); }
.graph-toolbar select, .graph-search input { min-height: 36px; border: 1px solid var(--border, #d8dde9); border-radius: 9px; background: var(--panel, #fff); color: inherit; }
.graph-search { display: flex; align-items: center; gap: 6px; min-width: 210px; }
.graph-search span { opacity: .6; }
.graph-search input { width: 220px; padding: 0 10px; }
.graph-stage { position: relative; min-width: 0; min-height: 0; align-self: stretch; overflow: hidden; touch-action: none; }
#knowledge-graph-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; outline: none; }
#knowledge-graph-canvas:active { cursor: grabbing; }
.graph-label-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.graph-node-label { position: absolute; max-width: 180px; padding: 3px 7px; border-radius: 999px; background: rgba(15,23,42,.64); border: 1px solid rgba(148,163,184,.18); color: #e5eefc; font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: 0 10px 24px rgba(2,6,23,.18); backdrop-filter: blur(10px); }
.graph-node-label.selected, .graph-node-label.hovered { background: rgba(79,70,229,.78); color: #fff; border-color: rgba(199,210,254,.4); }
.graph-node-label.cluster { background: rgba(30,41,59,.72); }
.graph-tooltip { position: absolute; z-index: 9; min-width: 180px; max-width: min(280px, calc(100% - 28px)); padding: 10px 12px; border-radius: 14px; border: 1px solid rgba(148,163,184,.24); background: color-mix(in srgb, rgba(15,23,42,.96) 86%, rgba(79,70,229,.18)); color: #f8fafc; box-shadow: 0 16px 40px rgba(2,6,23,.32); backdrop-filter: blur(16px); pointer-events: none; transform: translate3d(0,0,0); }
.graph-tooltip[hidden] { display: none; }
.graph-tooltip strong { display: block; font-size: 13px; line-height: 1.3; margin-bottom: 4px; }
.graph-tooltip span { display: block; color: rgba(226,232,240,.82); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.graph-tooltip p { margin: 7px 0 0; color: rgba(226,232,240,.96); font-size: 12px; line-height: 1.4; }
.graph-loading, .graph-empty { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; text-align: center; pointer-events: none; color: var(--muted, #667085); }
.graph-loading[hidden], .graph-empty[hidden] { display: none; }
.graph-loading span, .graph-empty span { max-width: 430px; font-size: 13px; }
.graph-legend { position: absolute; left: 14px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 7px 9px; border: 1px solid var(--border, #d8dde9); border-radius: 10px; background: color-mix(in srgb, var(--panel, #fff) 88%, transparent); backdrop-filter: blur(12px); font-size: 11px; color: var(--muted, #667085); }
.graph-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; background: #6676e8; }
.legend-dot.ghost { background: transparent; border: 1.5px dashed #7d87ff; }
.legend-line { width: 18px; border-top: 2px solid #626b7d; }
.legend-line.derived { border-top-style: dashed; opacity: .65; }
.legend-line.semantic { border-top-style: dotted; opacity: .55; }
.graph-status { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: min(620px, 70%); padding: 6px 9px; border-radius: 9px; background: color-mix(in srgb, var(--panel, #fff) 88%, transparent); font-size: 12px; color: var(--muted, #667085); text-align: center; pointer-events: none; }
.graph-space-inspector { position: absolute; top: 66px; right: 14px; bottom: 50px; width: min(340px, calc(100% - 28px)); overflow: auto; z-index: 7; padding: 12px; border: 1px solid var(--border, #d8dde9); border-radius: 14px; background: color-mix(in srgb, var(--panel, #fff) 94%, transparent); box-shadow: 0 16px 42px rgba(24,32,56,.16); backdrop-filter: blur(16px); }
.graph-space-inspector[hidden] { display: none; }
.graph-inspector-header { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.graph-inspector-eyebrow { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted, #667085); }
.graph-inspector-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.graph-space-inspector section { display: grid; gap: 5px; margin-top: 14px; }
.graph-inspector-row { width: 100%; border: 0; border-radius: 8px; padding: 7px 8px; background: transparent; color: inherit; text-align: left; font: inherit; cursor: pointer; }
.graph-inspector-row:hover, .graph-inspector-row:focus-visible { background: rgba(102,118,232,.08); }
.graph-inspector-row.static { cursor: default; color: var(--muted, #667085); }
.graph-frontier-action { position: absolute; right: 14px; bottom: 14px; z-index: 6; min-height: 36px; border: 1px solid rgba(125,135,255,.4); border-radius: 10px; padding: 0 12px; background: color-mix(in srgb, var(--panel, #fff) 92%, #7d87ff 8%); color: inherit; font-weight: 600; cursor: pointer; }
.graph-accessible { border-top: 1px solid var(--border, #d8dde9); background: var(--panel, #fff); }
.graph-accessible > header { min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; }
#graph-accessible-list { max-height: 220px; overflow: auto; padding: 0 14px 12px; }
.graph-accessible-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; }
body.graph-focus .sidebar, body.graph-focus .topbar, body.graph-focus .bottom-nav, body.graph-focus #graph-accessible { display: none !important; }
body.graph-focus #graph-view { position: fixed; inset: 0; z-index: 100; }
@media (max-width: 760px) {
  .graph-toolbar { left: 10px; right: 10px; transform: none; overflow-x: auto; justify-content: flex-start; }
  .graph-search { min-width: 180px; }
  .graph-search input { width: 170px; }
  .graph-space-inspector { top: auto; bottom: 12px; max-height: 48%; width: calc(100% - 24px); right: 12px; }
  .graph-legend { display: none; }
  .graph-status { bottom: 58px; max-width: calc(100% - 28px); }
}
@media (prefers-reduced-motion: reduce) {
  .graph-view *, .graph-view *::before, .graph-view *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* 0.54 coarse-pointer release gate: primary/inline controls must expose at least a 44px acquisition box.
   RATIONALE: touch/stylus targets below 44px were a quantified release-gate failure and caused avoidable misses on tablets. */
@media (any-pointer: coarse) {
  .application-builder-action-row button { width: 44px; height: 44px; }
  .application-builder-header select { min-height: 44px; height: 44px; }
  html.has-touch .block-ai-handle { width: 44px; height: 44px; right: 48px; top: 1px; }
  .knowledge-table-column-remove { width: 44px; height: 44px; top: 0; right: 0; }
  .slide-navigation-controller button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .data-table-list button { min-height: 44px; }
  .user-chip { min-width: 44px; min-height: 44px; }
}


/* 0.71 Product Interaction Unification */
.legacy-placement,
.legacy-product-controls,
#document-insert-menu-button,
#document-insert-menu,
#label-selected-block,
.editor-toolbar [data-open-ai="true"],
#canvas-insert-menu-button,
#canvas-insert-menu,
#canvas-add-sheet,
#document-insert-contributions,
#document-block-action-contributions,
#canvas-insert-contributions,
#canvas-context-action-contributions,
#topbar-contributions,
#workspace-menu-contributions { display: none !important; }

.product-topbar { gap: 8px; }
.product-topbar .brand-mark { margin-right: 2px; }
.product-topbar .document-title { min-width: 160px; max-width: min(420px, 32vw); }
.product-view-tabs { flex: 0 0 auto; }
.product-view-tabs .tab { min-width: 72px; }
.product-primary-action,
.launcher-button { display: inline-flex; align-items: center; gap: 7px; }
.launcher-button kbd { opacity: .58; font-size: 10px; }
.sync-state.healthy { display: none; }

.unified-launcher-dialog,
.product-add-dialog,
.share-dialog { border: 0; padding: 0; background: transparent; color: inherit; width: min(680px, calc(100vw - 24px)); }
.unified-launcher-dialog::backdrop,
.product-add-dialog::backdrop,
.share-dialog::backdrop { background: rgba(7, 10, 18, .48); backdrop-filter: blur(4px); }
.unified-launcher-form,
.product-add-form,
.share-form { background: var(--panel, #171c28); border: 1px solid var(--line, rgba(255,255,255,.12)); border-radius: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.38); overflow: hidden; }
.unified-launcher-form > header { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line, rgba(255,255,255,.1)); }
.unified-launcher-form > header input { width: 100%; border: 0; background: transparent; color: inherit; font-size: 18px; outline: 0; }
.launcher-summary { padding: 8px 16px; color: var(--muted, #96a0b5); font-size: 12px; }
.unified-launcher-list { max-height: min(60vh, 520px); overflow: auto; padding: 6px; }
.launcher-result { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: left; }
.launcher-result:hover, .launcher-result.active { background: rgba(125, 139, 255, .13); }
.launcher-result > span:first-child { display: grid; gap: 2px; }
.launcher-result small { color: var(--muted, #96a0b5); }
.launcher-ai-badge { font-size: 11px; padding: 3px 7px; border-radius: 999px; background: rgba(125,139,255,.17); }
.unified-launcher-form > footer { display: flex; gap: 7px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line, rgba(255,255,255,.1)); color: var(--muted, #96a0b5); font-size: 11px; }

.product-add-form > header,
.share-form > header { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 20px 10px; }
.product-add-form h2,.share-form h2 { margin: 0 0 4px; }
.product-add-form p,.share-form p { margin: 0; color: var(--muted, #96a0b5); }
.product-add-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; padding: 12px; max-height: 62vh; overflow: auto; }
.product-add-item { display: flex; width: 100%; padding: 13px 14px; border: 1px solid var(--line, rgba(255,255,255,.1)); border-radius: 12px; background: rgba(255,255,255,.025); color: inherit; text-align: left; }
.product-add-item:hover { background: rgba(125,139,255,.11); border-color: rgba(125,139,255,.34); }
.product-add-item span { display: grid; gap: 3px; }
.product-add-item small { color: var(--muted, #96a0b5); }
.product-add-form > footer { padding: 10px 16px 16px; color: var(--muted, #96a0b5); font-size: 12px; }

.share-form { padding-bottom: 16px; }
.share-form fieldset { margin: 8px 20px 14px; border: 1px solid var(--line, rgba(255,255,255,.1)); border-radius: 12px; display: grid; gap: 10px; }
.share-form fieldset label { display: flex; gap: 8px; align-items: center; }
.share-actions { display: flex; gap: 8px; padding: 0 20px; flex-wrap: wrap; }

.related-drawer { position: fixed; z-index: 75; top: 62px; right: 12px; bottom: 12px; width: min(380px, calc(100vw - 24px)); background: var(--panel, #171c28); border: 1px solid var(--line, rgba(255,255,255,.12)); border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.35); padding: 14px; overflow: auto; }
.related-drawer > header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.related-drawer > header div { display: grid; gap: 3px; }
.related-drawer > header span { color: var(--muted, #96a0b5); font-size: 12px; }
.related-summary { display: grid; gap: 7px; }
.related-summary > button { text-align: left; padding: 10px 12px; border-radius: 10px; }
.related-backlinks-proxy { margin-top: 14px; padding: 12px; border-radius: 10px; background: rgba(255,255,255,.03); color: var(--muted, #96a0b5); font-size: 12px; }

.contextual-action-bar { position: fixed; z-index: 68; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; padding: 6px; border: 1px solid var(--line, rgba(255,255,255,.14)); border-radius: 14px; background: rgba(20,25,36,.96); box-shadow: 0 16px 48px rgba(0,0,0,.32); backdrop-filter: blur(12px); }
.contextual-action-bar[hidden] { display: none; }
.contextual-action-bar button { min-height: 38px; padding: 7px 10px; border-radius: 9px; }

.graph-map-options { position: relative; }
.graph-map-options > summary { list-style: none; cursor: pointer; padding: 7px 10px; border-radius: 8px; }
.graph-map-options > summary::-webkit-details-marker { display:none; }
.graph-map-options[open] { background: var(--panel, #171c28); border-radius: 10px; padding: 3px; }
.graph-map-options select { margin-top: 4px; }

@media (max-width: 820px) {
  .product-topbar .brand-mark, .launcher-button span:not(:first-child), .launcher-button kbd, .product-primary-action span:last-child { display:none; }
  .product-topbar .document-title { min-width: 80px; max-width: 28vw; }
  .product-view-tabs .tab { min-width: 58px; padding-inline: 8px; }
  .product-add-list { grid-template-columns: 1fr; }
  .contextual-action-bar { bottom: 68px; max-width: calc(100vw - 20px); overflow-x: auto; justify-content: flex-start; }
}
.product-add-search { display:flex; align-items:center; gap:8px; margin:0 12px 4px; padding:9px 11px; border:1px solid var(--line, rgba(255,255,255,.1)); border-radius:10px; background:rgba(255,255,255,.025); }
.product-add-search input { width:100%; border:0; outline:0; background:transparent; color:inherit; }
.related-content { display:grid; gap:12px; margin-top:14px; }
.related-content section { display:grid; gap:8px; padding:12px; border-radius:10px; background:rgba(255,255,255,.03); }
.related-content p { margin:0; color:var(--muted, #96a0b5); font-size:12px; line-height:1.45; }
.application-configure-advanced { grid-column:1 / -1; border:1px solid var(--line, rgba(255,255,255,.1)); border-radius:12px; padding:10px; }
.application-configure-advanced > summary, .tool-studio-advanced > summary { cursor:pointer; font-weight:650; }
.application-configure-advanced[open] { display:grid; gap:12px; }
.share-actions { padding: 8px 20px 4px; }

/* Graph Space 0.74 incremental renderer overlays */
.graph-label-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.graph-node-label { position: absolute; max-width: 220px; padding: 2px 5px; border-radius: 5px; background: color-mix(in srgb, var(--panel, #111827) 72%, transparent); color: var(--text, #eef2ff); font-size: 11px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .86; }
.graph-node-label.cluster { font-weight: 650; opacity: .92; }
.graph-node-label.selected { outline: 1px solid color-mix(in srgb, currentColor 65%, transparent); opacity: 1; }
@media (prefers-reduced-motion: reduce) { #knowledge-graph-canvas, .graph-node-label { transition: none !important; } }

/* 1.0.25 UX convergence: compact, predictable, tablet-first controls */
:root {
  --control-hit-size: 44px;
  --control-visual-size: 34px;
  --control-icon-size: 17px;
  --control-radius: 9px;
  --surface-elevated: color-mix(in srgb, var(--panel) 94%, #26304a 6%);
  --hairline: color-mix(in srgb, var(--line) 78%, transparent);
}

/* Equivalent actions use one visual contract. The surrounding toolbar preserves
   a generous pointer/touch acquisition area without making every control bulky. */
.icon-button,
.tool-button,
.canvas-toolbar .toolbar-pin,
#toggle-canvas-toolbar {
  width: var(--control-visual-size);
  min-width: var(--control-visual-size);
  height: var(--control-visual-size);
  min-height: var(--control-visual-size);
  padding: 0;
  border-radius: var(--control-radius);
}
.icon-button svg,
.tool-button svg,
.canvas-toolbar .toolbar-pin svg {
  width: var(--control-icon-size);
  height: var(--control-icon-size);
}
.canvas-toolbar.collapsed { width: calc(var(--control-visual-size) + 8px); }
.canvas-toolbar.collapsed .toolbar-pin { margin: 0; }
.canvas-toolbar .toolbar-pin {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.canvas-toolbar .toolbar-pin::before { content: none; }

.product-topbar {
  min-height: var(--topbar);
  padding-inline: 8px;
  border-bottom-color: rgba(255,255,255,.07);
  box-shadow: 0 1px 0 rgba(0,0,0,.22);
}
.product-view-tabs {
  gap: 1px;
  padding: 2px;
  border-radius: 10px;
  background: rgba(255,255,255,.035);
}
.product-view-tabs .tab {
  min-width: 68px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 650;
  letter-spacing: -.01em;
}
.product-view-tabs .tab[data-product-view="vector"] { min-width: 92px; }
.product-primary-action,
.launcher-button,
#sync-state-button,
#user-button {
  min-height: 32px;
  border-radius: 9px;
}
.launcher-button { max-width: 170px; }
.sync-state-label { white-space: nowrap; }

.floating-toolbar {
  padding: 4px;
  border-radius: 12px;
  border-color: rgba(255,255,255,.09);
  background: color-mix(in srgb, var(--panel) 91%, transparent);
  box-shadow: 0 10px 34px rgba(0,0,0,.26), inset 0 1px rgba(255,255,255,.025);
}
.canvas-toolbar { max-width: calc(100% - 120px); }
.canvas-toolbar .toolbar-content { gap: 3px; }
.present-tool {
  color: #f7f8ff;
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  background: color-mix(in srgb, var(--accent) 17%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.025);
}
.present-tool:hover,
.present-tool:focus-visible {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  border-color: color-mix(in srgb, var(--accent) 72%, transparent);
}

/* The selection rail is intentionally limited to four stable actions. */
.contextual-action-bar {
  bottom: 16px;
  gap: 3px;
  transition: transform .14s ease, width .14s ease, padding .14s ease;
  padding: 4px;
  border-radius: 12px;
  background: rgba(17,20,27,.94);
  box-shadow: 0 14px 42px rgba(0,0,0,.34);
}
.contextual-action-bar .contextual-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}
.contextual-action-bar .contextual-action:hover { background: rgba(255,255,255,.055); border-color: rgba(255,255,255,.07); }
.contextual-action-bar .contextual-action svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }

/* Premium Add surface: hierarchy first, fewer permanent buttons. */
.product-add-dialog { border-radius: 18px; border-color: rgba(255,255,255,.1); box-shadow: 0 30px 100px rgba(0,0,0,.5); }
.product-add-form > header { padding: 18px 18px 12px; }
.product-add-list { gap: 7px; padding: 10px 12px 16px; }
.product-add-group {
  grid-column: 1 / -1;
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.product-add-item {
  min-height: 62px;
  padding: 11px 12px;
  border-radius: 11px;
  border-color: rgba(255,255,255,.075);
  background: linear-gradient(180deg, rgba(255,255,255,.025), rgba(255,255,255,.012));
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.product-add-item:hover,
.product-add-item:focus-visible {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(125,139,255,.13), rgba(125,139,255,.07));
  border-color: rgba(141,162,255,.42);
  outline: none;
}
.product-add-item strong { font-size: 13px; }
.product-add-item small { line-height: 1.35; }

/* Start-from examples */
.template-section-heading {
  grid-column: 1 / -1;
  display: grid;
  gap: 3px;
  margin: 14px 2px 3px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}
.template-section-heading strong { font-size: 13px; }
.template-section-heading span { color: var(--muted); font-size: 12px; }
.application-example-card {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 8%, var(--panel-2)), var(--panel-2));
}
.application-example-card small { display: block; margin-top: 5px; color: color-mix(in srgb, var(--accent) 70%, var(--muted)); font-size: 10px; }

/* Sidebar actions are consistent across mouse, keyboard, and touch. */
.document-row { grid-template-columns: 16px minmax(0,1fr) auto; }
.document-actions { display: flex; align-items: center; gap: 1px; padding-right: 2px; }
.document-actions .icon-button { width: 28px; min-width: 28px; height: 28px; min-height: 28px; }
.document-more { opacity: .72; }
.document-row:hover .document-more,
.document-row:focus-within .document-more { opacity: 1; }
.sidebar-context-menu {
  position: fixed;
  z-index: 120;
  min-width: 212px;
  padding: 5px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 11px;
  background: rgba(19,22,29,.98);
  box-shadow: 0 18px 48px rgba(0,0,0,.4);
  backdrop-filter: blur(18px);
}
.sidebar-context-menu button { display: flex; width: 100%; min-height: 34px; align-items: center; padding: 6px 9px; border: 0; border-radius: 7px; background: transparent; color: inherit; text-align: left; }
.sidebar-context-menu button:hover { background: rgba(255,255,255,.06); }
.sidebar-context-menu .danger { color: #ff929b; }

/* Quick capture communicates destination and never treats Cancel as validation. */
.capture-shortcut-hint { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.quick-capture-destination-help { color: var(--muted); font-size: 11px; line-height: 1.4; }

/* External data connection wizard */
.live-connectors-dialog { width: min(880px, calc(100vw - 24px)); max-height: min(860px, calc(100vh - 24px)); padding: 0; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.live-connectors-shell { display: grid; gap: 0; max-height: inherit; overflow: auto; }
.live-connectors-shell > header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(16px); }
.live-connectors-shell > header > div { display: grid; gap: 3px; }
.live-connectors-shell > header small { color: var(--muted); }
.data-connection-steps { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 0; padding: 12px 18px; list-style: none; border-bottom: 1px solid var(--border); }
.data-connection-steps li { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.data-connection-steps b { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 999px; background: var(--surface-2); }
.data-connection-steps li.active { color: var(--text); }
.data-connection-steps li.active b { background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); color: var(--accent); }
.live-connectors-shell [data-live-connectors-list] { display: grid; gap: 8px; padding: 12px 18px 0; }
.live-connector-add { margin: 12px 18px 18px; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.live-connector-add > summary { cursor: pointer; font-weight: 700; }
.live-connectors-shell [data-live-connectors-form] { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 12px; }
.live-connector-field { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.live-connector-field input,
.live-connector-field select { min-height: 38px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); }
.live-connector-help { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.live-connector-advanced { grid-column: 1 / -1; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; }
.live-connector-advanced > summary { cursor: pointer; font-size: 12px; font-weight: 650; }
.live-connector-advanced-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; padding-top: 10px; }
.live-connector-card { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.live-connector-card > header { display: flex; justify-content: space-between; gap: 10px; }
.live-connector-card > header > div:first-child { display: grid; gap: 3px; }
.live-connector-card small { color: var(--muted); }
.live-connector-card dl { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; margin: 10px 0 0; }
.live-connector-card dl > div { padding: 7px; border-radius: 8px; background: var(--surface); }
.live-connector-card dt { color: var(--muted); font-size: 10px; }
.live-connector-card dd { margin: 3px 0 0; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }

/* Information Vector Space: spatial depth and discoverable orbit controls. */
.graph-view {
  background:
    radial-gradient(circle at 55% 42%, rgba(108,129,255,.12), transparent 36%),
    radial-gradient(circle at 28% 70%, rgba(89,209,180,.06), transparent 32%),
    linear-gradient(180deg, #0d1320, #0b101a);
}
.graph-stage::after {
  content: "Drag to orbit · Shift-drag to pan · Scroll to zoom";
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 3;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  background: rgba(11,15,24,.64);
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
  backdrop-filter: blur(10px);
}
.graph-toolbar { border-radius: 12px; }
#graph-view-mode[aria-pressed="true"] { color: white; background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.graph-node-label { text-shadow: 0 1px 8px rgba(0,0,0,.85); }

/* Tablet policy: preserve flow by showing only high-priority controls. */
@media (max-width: 1100px) {
  .product-topbar .document-title { min-width: 110px; max-width: 23vw; }
  .launcher-button { max-width: 118px; }
  .sync-state-label { display: none; }
  .canvas-toolbar { max-width: calc(100% - 98px); }
}
@media (max-width: 860px) {
  .product-view-tabs .tab { min-width: 50px; padding-inline: 8px; }
  .product-view-tabs .tab[data-product-view="vector"] { min-width: 74px; }
  .product-topbar .document-title { max-width: 20vw; }
  .launcher-button span { display: none; }
  .launcher-button { width: var(--control-visual-size); min-width: var(--control-visual-size); padding: 0; }
  .contextual-action-bar .contextual-action { width: 38px; min-width: 38px; justify-content: center; padding-inline: 0; }
  .contextual-action-bar .contextual-action span { display: none; }
  .live-connectors-shell [data-live-connectors-form],
  .live-connector-advanced-fields { grid-template-columns: 1fr; }
  .live-connector-card dl { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .product-view-tabs .tab { min-width: 42px; font-size: 11px; }
  .product-view-tabs .tab[data-product-view="vector"] .tab-label { font-size: 0; }
  .product-view-tabs .tab[data-product-view="vector"] .tab-label::after { content: "Space"; font-size: 11px; }
  .product-topbar .document-title { max-width: 25vw; min-width: 74px; }
  .product-primary-action span:last-child { display: none; }
  .product-primary-action { width: var(--control-visual-size); min-width: var(--control-visual-size); padding: 0; }
  .canvas-toolbar { right: 6px; max-width: none; }
  .graph-stage::after { display: none; }
  .data-connection-steps { grid-template-columns: 1fr; }
}
@media (any-pointer: coarse) {
  .icon-button,
  .tool-button,
  .canvas-toolbar .toolbar-pin,
  .contextual-action-bar .contextual-action,
  .document-actions .icon-button {
    position: relative;
  }
  .icon-button::after,
  .tool-button::after,
  .canvas-toolbar .toolbar-pin::after,
  .contextual-action-bar .contextual-action::after,
  .document-actions .icon-button::after {
    content: "";
    position: absolute;
    inset: calc((var(--control-hit-size) - var(--control-visual-size)) / -2);
  }
}

/* 1.0.25 interaction integrity and presentation polish */
.canvas-inline-text-editor {
  position: absolute;
  z-index: 45;
  box-sizing: border-box;
  min-width: 88px;
  min-height: 42px;
  resize: none;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 74%, white 8%);
  border-radius: 8px;
  outline: 3px solid color-mix(in srgb, var(--accent) 24%, transparent);
  background: color-mix(in srgb, var(--panel) 84%, transparent);
  color: var(--text);
  padding: 5px 7px;
  font: 600 24px/1.2 system-ui, sans-serif;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
  backdrop-filter: blur(8px);
}
.canvas-inline-text-editor[hidden] { display: none; }

.canvas-slide-object rect {
  fill: rgba(110,130,255,.018);
  stroke: rgba(151,169,255,.72);
  stroke-width: 1.5;
  stroke-dasharray: 10 7;
}
.canvas-slide-object text {
  fill: rgba(214,221,255,.88);
  font: 700 13px system-ui, sans-serif;
  paint-order: stroke;
  stroke: rgba(8,12,20,.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}
body.presentation-presenting .canvas-slide-object,
body.presentation-following .canvas-slide-object { opacity: 0; }
.slide-frame-tool { color: #dfe5ff; }

/* One bottom action surface. The older Canvas rail is retained in the DOM for
   compatibility but hidden whenever the consolidated contextual rail exists. */
body.product-shell-ready .canvas-selection-bar { display: none !important; }

/* Closing Properties hides the panel without clearing selection. */
.canvas-inspector[data-user-hidden="true"] { display: none !important; }
.canvas-inspector .inspector-header .icon-button { opacity: .72; }
.canvas-inspector .inspector-header .icon-button:hover { opacity: 1; }

/* Expensive/trustworthy density: compact primary actions, quieter outlines,
   and no oversized top-bar pills. */
.product-topbar { gap: 5px; padding-inline: 7px; }
.product-primary-action,
.launcher-button,
#share-button,
#product-add-button {
  min-height: 30px;
  height: 30px;
  padding-inline: 9px;
  gap: 5px;
  border-radius: 8px;
  font-weight: 650;
  letter-spacing: -.01em;
}
#share-button { box-shadow: none; }
.launcher-button { max-width: 142px; }
.product-topbar .document-title { border-left-color: rgba(255,255,255,.06); }

/* The Vector Space must use every available pixel. The accessible list is a
   collapsed alternative, not an unexplained permanent bottom panel. */
.graph-space-shell { grid-template-rows: minmax(0, 1fr) auto; overflow: hidden; }
.graph-stage { min-width: 0; min-height: 0; align-self: stretch; overflow: hidden; }
.graph-accessible { flex: none; }
.graph-accessible > header { min-height: 38px; gap: 12px; }
.graph-accessible > header > div { display: grid; gap: 1px; min-width: 0; }
.graph-accessible > header small { color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#graph-accessible-list[hidden] { display: none; }

@media (max-width: 900px) {
  .product-primary-action,
  .launcher-button,
  #share-button,
  #product-add-button { width: 34px; min-width: 34px; padding: 0; justify-content: center; }
  .product-primary-action span,
  .launcher-button span,
  #share-button span { display: none; }
  .graph-accessible > header small { display: none; }
}

/* 1.0.25 sidebar discovery and topbar refinement */
.sidebar-page-search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 8px 7px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.sidebar-page-search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 48%, rgba(255,255,255,.12));
  background: rgba(255,255,255,.04);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}
.sidebar-page-search svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; }
.sidebar-page-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 500 12px/1.2 system-ui, sans-serif; }
.sidebar-page-search input::placeholder { color: color-mix(in srgb, var(--muted) 84%, transparent); }
#share-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.product-topbar > .button { border-color: rgba(255,255,255,.075); }
.product-topbar > .button.quiet { background: rgba(255,255,255,.018); }
.product-topbar > .button.quiet:hover { background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.12); }
.contextual-action-bar .contextual-action[aria-label="Delete"] { color: #f2b8bf; }
.contextual-action-bar .contextual-toolbar-pin {
  width: var(--control-visual-size);
  min-width: var(--control-visual-size);
  height: var(--control-visual-size);
  min-height: var(--control-visual-size);
  justify-content: center;
  padding: 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.contextual-action-bar .contextual-toolbar-pin span { display: none; }
.contextual-action-bar .contextual-toolbar-pin svg {
  width: var(--control-icon-size);
  height: var(--control-icon-size);
  transition: transform .14s ease;
}
.contextual-action-bar.collapsed {
  width: calc(var(--control-visual-size) + 8px);
  transform: translate(-50%, 8px);
  min-width: calc(var(--control-visual-size) + 8px);
  gap: 0;
  padding: 4px;
  overflow: hidden;
}
.contextual-action-bar.collapsed .contextual-action:not(.contextual-toolbar-pin) { display: none; }
.contextual-action-bar.collapsed .contextual-toolbar-pin { margin: 0; }
.contextual-action-bar.collapsed .contextual-toolbar-pin svg { transform: rotate(180deg); }
@media (max-width: 900px) {
  #share-button svg { width: 17px; height: 17px; }
}

/* 1.0.26 Vector Space visibility and failure boundary */
.graph-error { position: absolute; inset: 0; z-index: 9; display: grid; place-content: center; justify-items: center; gap: 9px; padding: 24px; text-align: center; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text); }
.graph-error[hidden] { display: none; }
.graph-error > span { max-width: 470px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.graph-error > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.graph-stage[data-graph-lifecycle="waiting-for-size"] #knowledge-graph-canvas { visibility: visible; }
.graph-stage[data-graph-lifecycle="ready"] #knowledge-graph-canvas,
.graph-stage[data-graph-lifecycle="empty"] #knowledge-graph-canvas { visibility: visible; }
.presentation-preflight-dialog { width: min(520px, calc(100vw - 24px)); border: 1px solid var(--border); border-radius: 18px; padding: 0; background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgba(0,0,0,.34); }
.presentation-preflight-dialog::backdrop { background: rgba(5,10,20,.58); backdrop-filter: blur(8px); }
.presentation-preflight-dialog .dialog-content { display: grid; gap: 12px; padding: 20px; }
.presentation-preflight-dialog footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

/* 1.0.27 stable Vector Space viewport contract */
#graph-view.active { display: block; min-width: 0; min-height: 0; }
#graph-view.active { position: absolute; inset: 0; }
#graph-view .graph-space-shell { contain: layout paint; }
#graph-view .graph-stage { block-size: auto; }
#graph-view .graph-accessible { max-height: 42px; overflow: hidden; }
#graph-view .graph-accessible:has(#graph-accessible-list:not([hidden])) { max-height: min(42vh, 280px); }

/* 1.0.27 interaction and governance polish */
.product-topbar > .button,
.product-topbar > .user-chip,
.product-topbar > .sync-state {
  min-height: 34px;
  height: 34px;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}
.product-topbar > .button:hover,
.product-topbar > .user-chip:hover,
.product-topbar > .sync-state:hover { background: color-mix(in srgb, var(--surface-strong, #252b38) 72%, transparent); }
.product-topbar #share-button { background: color-mix(in srgb, var(--accent, #7188ff) 72%, transparent); color: #fff; }
.product-topbar #share-button:hover { background: color-mix(in srgb, var(--accent, #7188ff) 88%, transparent); }
.product-topbar #launcher-button { display: none; }
.sidebar-search-row { display: grid; grid-template-columns: minmax(0,1fr) 36px; gap: 6px; align-items: center; padding: 0 8px 8px; }
.sidebar-search-row .sidebar-page-search { margin: 0; min-width: 0; }
.sidebar-command-search { width: 36px; height: 36px; border-radius: 10px; }
.sidebar-command-search svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.space-list { display: grid; gap: 8px; margin: 8px 0 16px; max-height: min(42vh, 380px); overflow: auto; }
.space-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--border, #303746); border-radius: 12px; background: color-mix(in srgb, var(--surface, #171b24) 92%, transparent); }
.space-row.current { border-color: color-mix(in srgb, var(--accent, #7188ff) 70%, var(--border, #303746)); }
.space-row span { min-width: 0; display: grid; gap: 3px; }
.space-row strong,.space-row small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-row small { color: var(--muted, #9aa4b7); }
.admin-dialog { width: min(900px, calc(100vw - 28px)); }
.admin-user-editor { display: grid; gap: 12px; margin-top: 14px; }
.profile-actions { align-items: stretch; }
.profile-actions .status { flex-basis: 100%; }
@media (max-width: 760px) {
  .product-topbar #product-add-button span:last-child,
  .product-topbar #share-button span { display: none; }
  .product-topbar > .button { width: 36px; padding-inline: 8px; }
  .space-create-row { display: grid; grid-template-columns: 1fr; }
}

/* 1.0.27 R28: compact controls for a semantic-first Vector Space. */
.graph-toolbar {
  width: min(760px, calc(100% - 28px));
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto auto;
  gap: 4px;
  padding: 6px;
  border-radius: 12px;
}
.graph-search { width: 100%; min-width: 0; }
.graph-search input { width: 100%; min-width: 0; }
.graph-toolbar > select { width: 102px; min-width: 0; padding-inline: 7px; }
.graph-toolbar .tool-button { min-width: 34px; height: 34px; padding: 0 9px; justify-content: center; }
#graph-layout { width: 34px; padding: 0; font-size: 17px; }
#graph-legend { display: none !important; }
.graph-stage::after { display: none; }
.graph-status { bottom: 10px; max-width: min(560px, calc(100% - 28px)); padding: 5px 8px; }
#graph-view .graph-accessible { max-height: 34px; }
.graph-accessible > header { min-height: 34px; padding: 0 10px; }

/* 1.0.29 Vector Space + workspace navigation coherence. */
@media (min-width: 721px) {
  :root { --sidebar: 286px; }
}

body.vector-space-active .canvas-selection-bar { display: none !important; }

/* The sidebar is a manually ordered page rail.  Give titles the width that
   used to be consumed by the always-visible action cluster. */
.document-row { grid-template-columns: 18px minmax(0, 1fr) 30px; }
.document-drag { width: 18px; min-width: 18px; opacity: .46; cursor: grab; touch-action: none; }
.document-row:hover .document-drag, .document-row:focus-within .document-drag { opacity: .95; }
.document-row.dragging .document-drag { cursor: grabbing; }
.document-row[draggable="true"] .document-item { cursor: grab; }
.document-row.dragging .document-item { cursor: grabbing; }
.document-item { min-width: 0; }
.document-item strong { font-size: 13px; line-height: 1.25; }
.document-item span, .document-section-label { font-size: 11px; line-height: 1.25; }
.document-actions { justify-content: end; min-width: 30px; }
.document-actions .document-pin,
.document-actions .document-order,
.document-actions .document-delete { display: none !important; }
.document-actions .document-more { opacity: .25; }
.document-row:hover .document-actions .document-more,
.document-row:focus-within .document-actions .document-more,
.document-row.active .document-actions .document-more { opacity: .95; }

/* Align the chrome with the 13px page-title rhythm instead of mixing large
   toolbar labels with compact navigation labels. */
.topbar, .topbar .button, .topbar .tool-button, .topbar .tab,
.topbar .workspace-switcher, .topbar .user-chip, .topbar .sync-state { font-size: 13px; }
.topbar .document-title { font-size: 13px; }
.topbar .brand-mark { font-size: 13px; }

/* Compact, readable inspector: one primary action and related nodes, rather
   than a wide command palette floating over the map. */
.graph-space-inspector {
  top: 78px;
  right: 12px;
  bottom: 48px;
  width: min(308px, calc(100% - 24px));
  padding: 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.38;
}
.graph-space-inspector header { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.graph-space-inspector header strong { display: block; margin-top: 2px; font-size: 16px; line-height: 1.22; }
.graph-inspector-eyebrow { font-size: 11px; line-height: 1.25; letter-spacing: .045em; }
.graph-inspector-summary { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.42; }
.graph-inspector-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.42; }
.graph-inspector-actions { margin: 10px 0 0; gap: 6px; }
.graph-inspector-actions .button { min-height: 31px; padding: 4px 9px; font-size: 13px; }
.graph-space-inspector section { margin-top: 14px; gap: 3px; }
.graph-space-inspector section > strong { font-size: 13px; }
.graph-inspector-row { padding: 7px 8px; font-size: 13px; line-height: 1.3; }

/* A selected semantic neighborhood should read immediately: selected and
   directly connected labels stay crisp while all other labels recede. */
.graph-node-label.connected {
  background: rgba(37,99,235,.78);
  border-color: rgba(191,219,254,.82);
  color: #fff;
  font-weight: 650;
  box-shadow: 0 0 0 2px rgba(96,165,250,.16), 0 10px 24px rgba(2,6,23,.32);
}
.graph-node-label.selected { font-weight: 700; box-shadow: 0 0 0 2px rgba(255,255,255,.25), 0 12px 30px rgba(2,6,23,.42); }

@media (max-width: 720px) {
  .graph-space-inspector { top: auto; bottom: calc(var(--bottom) + 42px); right: 7px; width: min(300px, calc(100% - 14px)); max-height: min(54vh, 430px); }
  .document-actions .document-more { opacity: .9; }
}
.graph-accessible > header > strong { font-size: 12px; color: var(--muted); }
#graph-accessible .button { min-height: 28px; }
@media (max-width: 700px) {
  .graph-toolbar {
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    transform: none;
    overflow: visible;
    grid-template-columns: minmax(120px, 1fr) auto auto auto auto;
  }
  .graph-toolbar > select { width: 86px; }
  .graph-search span { display: none; }
  .graph-toolbar .tool-button { padding: 0 7px; }
}

/* Document export — confidence-first publication flow */
.interchange-export-dialog {
  width: min(1120px, calc(100vw - 28px));
  max-height: min(900px, calc(100dvh - 28px));
  border-color: color-mix(in srgb, var(--line-strong) 72%, transparent);
  border-radius: 20px;
  overflow: hidden;
  background: color-mix(in srgb, var(--panel) 94%, #101a2d 6%);
  box-shadow: 0 30px 90px rgba(0,0,0,.64), 0 0 0 1px rgba(255,255,255,.018) inset;
}
.interchange-export-dialog::backdrop { background: rgba(3,7,16,.76); backdrop-filter: blur(7px); }
.export-dialog-shell { display:grid; grid-template-rows:auto minmax(0,1fr) auto; min-height:min(760px,calc(100dvh - 30px)); max-height:min(900px,calc(100dvh - 30px)); }
.export-dialog-header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:22px 24px 18px; border-bottom:1px solid rgba(148,163,184,.14); }
.export-dialog-title { display:flex; align-items:center; gap:13px; min-width:0; }
.export-dialog-title > div { display:grid; gap:3px; }
.export-dialog-title strong { font-size:22px; line-height:1.18; letter-spacing:-.015em; }
.export-dialog-title small { color:var(--muted); font-size:13px; line-height:1.4; }
.export-dialog-mark { width:38px; height:38px; display:grid; place-items:center; flex:0 0 auto; border:1px solid rgba(125,151,255,.3); border-radius:11px; background:linear-gradient(145deg,rgba(109,140,255,.18),rgba(79,111,231,.07)); color:#dce4ff; font-size:20px; font-weight:700; }
.export-dialog-close { color:var(--muted); font-size:20px; }
.export-dialog-body { min-height:0; display:grid; grid-template-columns:minmax(0,1.04fr) minmax(390px,.96fr); overflow:hidden; }
.export-settings-pane { min-width:0; overflow:auto; padding:20px 24px 24px; border-right:1px solid rgba(148,163,184,.14); scrollbar-gutter:stable; }
.export-setting-section { display:grid; gap:12px; padding:0 0 20px; margin:0 0 20px; border-bottom:1px solid rgba(148,163,184,.12); }
.export-section-heading { display:flex; align-items:flex-start; gap:10px; }
.export-section-heading > span { width:23px; height:23px; display:grid; place-items:center; flex:0 0 auto; border-radius:999px; background:rgba(109,140,255,.18); border:1px solid rgba(109,140,255,.24); color:#dce4ff; font-size:11px; font-weight:800; }
.export-section-heading > div { display:grid; gap:2px; }
.export-section-heading strong { font-size:14px; line-height:1.25; }
.export-section-heading small { color:var(--muted); font-size:11.5px; line-height:1.35; }
.export-field-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.export-field { display:grid; gap:6px; min-width:0; color:var(--muted); font-size:11.5px; font-weight:650; }
.export-field-wide { grid-column:1/-1; }
.export-field select { width:100%; min-height:40px; padding:7px 34px 7px 10px; border:1px solid var(--line); border-radius:10px; background:color-mix(in srgb,var(--bg) 72%,var(--panel-2)); color:var(--text); outline:none; }
.export-field select:hover { border-color:var(--line-strong); }
.export-field select:focus { border-color:var(--accent); box-shadow:0 0 0 3px rgba(109,140,255,.13); }
.export-field > small { color:var(--muted); font-weight:450; line-height:1.4; }
.export-check-grid { display:grid; gap:8px; }
.export-check { display:grid; grid-template-columns:20px minmax(0,1fr); gap:10px; align-items:flex-start; min-height:48px; padding:10px 12px; border:1px solid rgba(148,163,184,.14); border-radius:11px; background:rgba(255,255,255,.012); cursor:pointer; }
.export-check:hover { border-color:rgba(109,140,255,.34); background:rgba(109,140,255,.035); }
.export-check input { width:16px; height:16px; margin:2px 0 0; accent-color:var(--accent); }
.export-check > span { display:grid; gap:2px; }
.export-check strong { font-size:12.5px; line-height:1.3; color:var(--text); }
.export-check small { color:var(--muted); font-size:11px; line-height:1.35; }
.export-advanced,.export-saved-settings { margin-top:10px; border:1px solid rgba(148,163,184,.14); border-radius:11px; background:rgba(255,255,255,.012); overflow:hidden; }
.export-advanced summary,.export-saved-settings summary { cursor:pointer; list-style:none; position:relative; padding:11px 36px 11px 12px; font-size:12.5px; font-weight:700; }
.export-advanced summary::-webkit-details-marker,.export-saved-settings summary::-webkit-details-marker { display:none; }
.export-advanced summary::after,.export-saved-settings summary::after { content:'›'; position:absolute; right:14px; top:50%; transform:translateY(-50%) rotate(90deg); color:var(--muted); font-size:18px; transition:transform .15s ease; }
.export-advanced[open] summary::after,.export-saved-settings[open] summary::after { transform:translateY(-50%) rotate(-90deg); }
.export-advanced-grid,.export-saved-settings-body { padding:0 12px 12px; }
.publication-profile-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; margin:10px 0 0; }
.publication-profile-actions .button { min-height:34px; padding-inline:8px; font-size:11.5px; }
.export-import-button { display:flex; align-items:center; justify-content:center; cursor:pointer; }
.export-preview-pane { min-width:0; min-height:0; display:grid; grid-template-rows:auto minmax(0,1fr); gap:12px; padding:20px 22px 22px; background:linear-gradient(180deg,rgba(8,14,26,.34),rgba(8,14,26,.12)); overflow:hidden; }
.export-preview-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.export-preview-heading > div { display:grid; gap:2px; }
.export-preview-heading strong { font-size:14px; }
.export-preview-heading small { color:var(--muted); font-size:11.5px; }
.export-preview-heading > span { flex:0 0 auto; padding:4px 7px; border-radius:999px; border:1px solid rgba(95,211,154,.22); background:rgba(95,211,154,.075); color:#a9ebc9; font-size:10px; font-weight:750; text-transform:uppercase; letter-spacing:.035em; }
.export-preview-frame { min-height:0; overflow:hidden; border:1px solid rgba(148,163,184,.2); border-radius:14px; padding:12px; background:rgba(2,6,18,.4); box-shadow:0 18px 44px rgba(0,0,0,.22) inset; }
.export-preview-frame iframe { display:block; width:100%; height:100%; min-height:520px; border:0; border-radius:9px; background:#fff; box-shadow:0 10px 30px rgba(0,0,0,.28); }
.export-dialog-footer { min-width:0; display:grid; grid-template-columns:minmax(230px,1fr) minmax(0,.8fr) auto; align-items:center; gap:16px; padding:14px 20px; border-top:1px solid rgba(148,163,184,.14); background:rgba(7,12,22,.28); }
.export-confidence { display:flex; align-items:center; gap:9px; min-width:0; }
.export-confidence > span { width:25px; height:25px; display:grid; place-items:center; flex:0 0 auto; border-radius:999px; background:rgba(95,211,154,.1); border:1px solid rgba(95,211,154,.18); color:#9ee6c0; font-size:12px; font-weight:850; }
.export-confidence > div { display:grid; gap:1px; min-width:0; }
.export-confidence strong { font-size:11.5px; line-height:1.3; }
.export-confidence small { color:var(--muted); font-size:10.5px; }
.export-footer-status { min-width:0; color:#c7d2fe; font-size:11px; text-align:right; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.export-footer-actions { display:flex; align-items:center; gap:8px; }
.export-footer-actions .button { min-height:38px; padding-inline:16px; }
.export-footer-actions .button.primary { min-width:116px; border-color:#7d97ff; background:linear-gradient(135deg,#6578ec,#6b8df1 55%,#55b9bb); box-shadow:0 8px 22px rgba(79,111,231,.2); font-weight:750; }
@media(max-width:900px){
  .interchange-export-dialog { width:min(760px,calc(100vw - 14px)); max-height:calc(100dvh - 14px); border-radius:15px; }
  .export-dialog-shell { min-height:calc(100dvh - 16px); max-height:calc(100dvh - 16px); }
  .export-dialog-body { grid-template-columns:1fr; overflow:auto; }
  .export-settings-pane { overflow:visible; border-right:0; }
  .export-preview-pane { min-height:560px; border-top:1px solid rgba(148,163,184,.14); }
  .export-dialog-footer { grid-template-columns:1fr auto; }
  .export-footer-status { grid-column:1/-1; grid-row:1; text-align:left; }
  .export-confidence { grid-column:1; grid-row:2; }
  .export-footer-actions { grid-column:2; grid-row:2; }
}
@media(max-width:600px){
  .export-dialog-header { padding:16px; }
  .export-dialog-title strong { font-size:19px; }
  .export-settings-pane,.export-preview-pane { padding:16px; }
  .export-field-grid { grid-template-columns:1fr; }
  .publication-profile-actions { grid-template-columns:1fr 1fr; }
  .export-dialog-footer { grid-template-columns:1fr; gap:10px; }
  .export-confidence,.export-footer-actions,.export-footer-status { grid-column:1; grid-row:auto; }
  .export-footer-actions { justify-content:flex-end; }
  .export-confidence small { display:none; }
  .export-preview-pane { min-height:470px; }
  .export-preview-frame iframe { min-height:410px; }
}

/* 1.0.30 workspace portability — user-facing save/open flow. */
.workspace-portability-card {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent, #7188ff) 28%, var(--line, #303746));
  border-radius: 14px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent, #7188ff) 7%, var(--panel, #171b24)), color-mix(in srgb, var(--panel, #171b24) 96%, transparent));
}
.workspace-portability-copy { display: grid; grid-template-columns: 38px minmax(0,1fr); gap: 12px; align-items: start; }
.workspace-portability-copy > div { display: grid; gap: 4px; min-width: 0; }
.workspace-portability-copy strong { font-size: 14px; line-height: 1.3; }
.workspace-portability-copy small { color: var(--muted, #9aa4b7); font-size: 12px; line-height: 1.5; max-width: 68ch; }
.workspace-portability-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent, #7188ff) 34%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent, #7188ff) 13%, transparent);
  color: #dce4ff;
  font-size: 19px;
  font-weight: 800;
}
.workspace-portability-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.workspace-portability-actions .button { min-height: 40px; }
.workspace-portability-note { margin: 0; color: var(--muted, #9aa4b7); font-size: 11.5px; line-height: 1.45; }
@media (max-width: 680px) {
  .workspace-portability-actions { display: grid; grid-template-columns: 1fr; }
  .workspace-portability-actions .button { width: 100%; }
}

/* 1.0.30 R25 workspace management UX — compact, vertically contained, user-facing. */
.workspace-dialog {
  width: min(760px, calc(100vw - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  overflow: hidden;
}
.workspace-dialog > .workspace-management {
  width: 100%;
  height: min(760px, calc(100dvh - 24px));
  max-height: min(760px, calc(100dvh - 24px));
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}
.workspace-dialog > .workspace-management > header {
  padding: 18px 20px 10px;
  gap: 16px;
}
.workspace-dialog > .workspace-management > header p { max-width: 58ch; }
.workspace-dialog > .workspace-management > .dialog-tabs {
  margin: 0 20px 10px;
}
.workspace-dialog > .workspace-management > .dialog-tab-panel {
  min-height: 0;
  overflow: auto;
  padding: 4px 20px 16px;
  scrollbar-gutter: stable;
}
.workspace-dialog > .workspace-management > menu {
  margin: 0;
  padding: 10px 20px 14px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent);
}
.workspace-spaces-panel { align-content: start; }
.workspace-section-heading { margin-bottom: 4px; }
.workspace-section-heading small { max-width: 46ch; }
.space-list {
  display: grid;
  gap: 5px;
  margin: 6px 0 12px;
  max-height: none;
  overflow: visible;
}
.space-row {
  min-height: 54px;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface, #171b24) 72%, transparent);
}
.space-row.current { background: color-mix(in srgb, var(--accent, #7188ff) 8%, var(--surface, #171b24)); }
.space-row-copy { min-width: 0; display: grid; gap: 2px; }
.space-row-copy strong { font-size: 13px; line-height: 1.25; }
.space-row-copy small { font-size: 11px; line-height: 1.3; }
.space-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.space-row-actions .button { min-height: 32px; padding-inline: 10px; }
.space-current-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--accent, #7188ff) 30%, var(--line));
  border-radius: 999px;
  color: color-mix(in srgb, var(--text) 88%, var(--accent));
  background: color-mix(in srgb, var(--accent, #7188ff) 10%, transparent);
  font-size: 11px;
  font-weight: 700;
}
.workspace-compact-section {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
}
.workspace-section-copy { display: grid; gap: 2px; min-width: 0; }
.workspace-section-copy strong { font-size: 13px; line-height: 1.3; }
.workspace-section-copy small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.workspace-compact-section .space-create-row { margin: 0; }
.workspace-portability-card {
  margin-top: 10px;
  padding: 11px 12px;
  gap: 9px;
  border-color: var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
}
.workspace-portability-actions { gap: 7px; }
.workspace-portability-actions .button { min-height: 34px; }
@media (max-height: 720px) {
  .workspace-dialog,
  .workspace-dialog > .workspace-management { height: calc(100dvh - 16px); max-height: calc(100dvh - 16px); }
  .workspace-dialog > .workspace-management > header { padding-top: 12px; padding-bottom: 7px; }
  .workspace-dialog > .workspace-management > .dialog-tabs { margin-bottom: 6px; }
  .workspace-dialog > .workspace-management > .dialog-tab-panel { padding-bottom: 10px; }
  .workspace-compact-section { margin-top: 7px; padding-block: 9px; }
}
@media (max-width: 680px) {
  .workspace-dialog > .workspace-management > header,
  .workspace-dialog > .workspace-management > .dialog-tab-panel,
  .workspace-dialog > .workspace-management > menu { padding-inline: 12px; }
  .workspace-dialog > .workspace-management > .dialog-tabs { margin-inline: 12px; }
  .space-row { grid-template-columns: minmax(0,1fr); }
  .space-row-actions { justify-content: flex-start; }
}

/* 1.0.30 R29 Canvas insert UX: the toolbar owns quick tools and a dedicated
   visual Shapes picker. The full Add dialog contains only Canvas objects. */
.canvas-shape-anchor { position: relative; }
.canvas-shape-trigger {
  width: auto;
  min-width: 78px;
  padding-inline: 9px;
  gap: 6px;
  color: #eef2ff;
}
.canvas-shape-trigger > svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.canvas-shape-trigger > span:first-of-type { font-size: 11px; font-weight: 700; }
.canvas-shape-chevron { color: var(--muted); font-size: 10px; transform: translateY(-1px); }
.canvas-shape-trigger:hover,
.canvas-shape-trigger[aria-expanded="true"] {
  border-color: rgba(134,157,255,.42);
  background: rgba(109,140,255,.11);
}
.canvas-shape-menu.command-menu {
  width: 306px;
  min-width: 306px;
  padding: 10px;
  border-radius: 16px;
  border-color: rgba(139,165,255,.22);
  background: rgba(17,22,32,.985);
  box-shadow: 0 24px 72px rgba(0,0,0,.52);
  overflow: hidden;
}
.canvas-shape-menu-header { display: grid; gap: 2px; padding: 2px 3px 10px; }
.canvas-shape-menu-header strong { font-size: 14px; letter-spacing: -.01em; }
.canvas-shape-menu-header small { color: var(--muted); font-size: 10px; line-height: 1.35; }
.canvas-shape-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px; }
.canvas-shape-menu.command-menu .canvas-shape-item {
  min-height: 78px;
  display: grid;
  grid-template-rows: 42px auto;
  place-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 6px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015));
  color: #eef2ff;
  text-align: center;
  white-space: normal;
}
.canvas-shape-menu.command-menu .canvas-shape-item:hover,
.canvas-shape-menu.command-menu .canvas-shape-item:focus-visible {
  border-color: rgba(139,165,255,.42);
  background: linear-gradient(180deg, rgba(109,140,255,.16), rgba(109,140,255,.07));
}
.canvas-shape-item > span:last-child { font-size: 10px; color: #d8def0; }
.canvas-shape-preview { position: relative; width: 32px; height: 28px; display: block; color: #b8c6ff; }
.canvas-shape-preview.rectangle { border: 2px solid currentColor; border-radius: 4px; }
.canvas-shape-preview.ellipse { border: 2px solid currentColor; border-radius: 50%; }
.canvas-shape-preview.triangle { width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent; border-bottom: 28px solid currentColor; opacity: .9; }
.canvas-shape-preview.diamond { width: 22px; height: 22px; border: 2px solid currentColor; transform: rotate(45deg); border-radius: 3px; }
.canvas-shape-preview.line::before { content: ''; position: absolute; left: 1px; right: 1px; top: 13px; height: 2px; border-radius: 999px; background: currentColor; transform: rotate(-22deg); transform-origin: center; }
.canvas-shape-preview.arrow { display: grid; place-items: center; font-size: 30px; line-height: 1; transform: translateY(-2px); }

/* Canvas Add is intentionally small and object-only. Workspace creation, quick
   capture, examples, connectors, and presentation mode live on their own surfaces. */
.product-add-dialog[data-add-context="canvas"] { width: min(640px, calc(100vw - 24px)); }
.product-add-dialog[data-add-context="canvas"] .product-add-form { max-height: min(78vh, 620px); }
.product-add-dialog[data-add-context="canvas"] .product-add-form > header { padding: 20px 20px 13px; }
.product-add-dialog[data-add-context="canvas"] .product-add-form > header h2 { font-size: 22px; letter-spacing: -.02em; }
.product-add-dialog[data-add-context="canvas"] .product-add-form > header p { max-width: 42ch; }
.product-add-dialog[data-add-context="canvas"] .product-add-search[hidden] { display: none !important; }
.product-add-dialog[data-add-context="canvas"] .product-add-list {
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 9px;
  padding: 8px 16px 18px;
  overflow: visible;
}
.product-add-dialog[data-add-context="canvas"] .product-add-group { display: none; }
.product-add-dialog[data-add-context="canvas"] .product-add-item {
  min-height: 116px;
  display: grid;
  grid-template-rows: 42px auto;
  align-content: start;
  justify-items: start;
  gap: 8px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.085);
  background: linear-gradient(180deg, rgba(255,255,255,.038), rgba(255,255,255,.014));
}
.product-add-dialog[data-add-context="canvas"] .product-add-item:hover,
.product-add-dialog[data-add-context="canvas"] .product-add-item:focus-visible {
  border-color: rgba(139,165,255,.46);
  background: linear-gradient(180deg, rgba(109,140,255,.17), rgba(109,140,255,.06));
  box-shadow: inset 0 1px rgba(255,255,255,.04);
}
.product-add-dialog[data-add-context="canvas"] .product-add-item-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(139,165,255,.18);
  background: rgba(109,140,255,.10);
  color: #dce5ff;
}
.product-add-dialog[data-add-context="canvas"] .product-add-item-icon::before { content: ''; display: block; width: 20px; height: 20px; box-sizing: border-box; }
.product-add-dialog[data-add-context="canvas"] [data-action-kind="text"] .product-add-item-icon::before { content: 'T'; width: auto; height: auto; font-size: 19px; font-weight: 750; line-height: 1; }
.product-add-dialog[data-add-context="canvas"] [data-action-kind="shape"] .product-add-item-icon::before { border: 2px solid currentColor; border-radius: 4px; }
.product-add-dialog[data-add-context="canvas"] [data-action-kind="arrow"] .product-add-item-icon::before { content: '→'; width: auto; height: auto; font-size: 24px; line-height: 1; }
.product-add-dialog[data-add-context="canvas"] [data-action-kind="draw"] .product-add-item-icon::before { width: 22px; height: 2px; border-radius: 999px; background: currentColor; transform: rotate(-35deg); box-shadow: 6px 4px 0 -0.5px currentColor; }
.product-add-dialog[data-add-context="canvas"] [data-action-kind="media"] .product-add-item-icon::before { border: 2px solid currentColor; border-radius: 4px; clip-path: polygon(0 0,100% 0,100% 100%,0 100%); background: linear-gradient(145deg, transparent 45%, currentColor 46% 53%, transparent 54%); }
.product-add-dialog[data-add-context="canvas"] [data-action-kind="frame"] .product-add-item-icon::before { border: 2px solid currentColor; border-radius: 3px; box-shadow: inset 0 -5px rgba(220,229,255,.18); }
.product-add-dialog[data-add-context="canvas"] .product-add-item-copy { display: grid; gap: 3px; }
.product-add-dialog[data-add-context="canvas"] .product-add-item strong { font-size: 14px; }
.product-add-dialog[data-add-context="canvas"] .product-add-item small { color: var(--muted); line-height: 1.35; }
.product-add-dialog[data-add-context="canvas"] .product-add-form > footer { padding: 11px 18px 14px; }

@media (max-width: 760px) {
  .canvas-shape-trigger { min-width: 38px; width: 38px; padding: 0; justify-content: center; }
  .canvas-shape-trigger > span { display: none; }
  .canvas-shape-menu.command-menu { width: min(306px, calc(100vw - 20px)); min-width: 0; }
  .product-add-dialog[data-add-context="canvas"] .product-add-list { grid-template-columns: repeat(2, minmax(0,1fr)); }
}



/* 1.0.30 R30: toolbar continuity and presentation readiness. */
.canvas-toolbar { top: 12px; left: 12px; z-index: 24; max-width: calc(100% - 24px); overflow: visible; }
@media (min-width: 761px) { .canvas-toolbar .toolbar-content { overflow: visible; } }
#canvas-frame-tool { color: #dfe5ff; }
#canvas-frame-tool:hover, #canvas-frame-tool:focus-visible { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.product-topbar #product-add-button { display: none !important; }

/* 1.0.30 R34 named presentation decks */
.presentation-scope {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(141,162,255,.18);
  border-radius: 11px;
  background: rgba(100,120,232,.055);
}
.presentation-scope label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.presentation-scope select,
.presentation-deck-toolbar select {
  width: 100%; min-width: 0; height: 34px; padding: 0 30px 0 9px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text);
  font: 600 12px/1 system-ui, sans-serif;
}
.presentation-deck-manager {
  display: grid; gap: 8px; padding: 9px 10px 10px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(100,120,232,.055), rgba(9,13,21,.12));
}
.presentation-deck-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: end; gap: 7px; }
.presentation-deck-toolbar label,
.presentation-deck-editor > label { min-width: 0; display: grid; gap: 4px; color: var(--muted); font-size: 10px; }
.presentation-deck-editor { display: grid; gap: 7px; }
.presentation-deck-editor[hidden] { display: none !important; }
.presentation-deck-editor input[type="text"] {
  width: 100%; min-width: 0; height: 32px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text);
}
.presentation-deck-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.presentation-deck-slide-list {
  display: grid; gap: 3px; max-height: 178px; overflow: auto;
  padding: 4px; border: 1px solid rgba(255,255,255,.055); border-radius: 9px; background: rgba(0,0,0,.08);
}
.presentation-deck-slide-row {
  min-width: 0; display: grid; grid-template-columns: 24px minmax(0,1fr) auto;
  gap: 7px; align-items: center; padding: 5px 5px 5px 6px; border-radius: 7px;
}
.presentation-deck-slide-row:hover { background: rgba(141,162,255,.075); }
.presentation-deck-slide-main { min-width: 0; display: grid; gap: 1px; }
.presentation-deck-slide-main strong,
.presentation-deck-slide-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presentation-deck-slide-main strong { font-size: 11px; }
.presentation-deck-slide-main small { color: var(--muted); font-size: 9px; }
.presentation-deck-slide-actions { display: flex; gap: 2px; }
.presentation-deck-slide-actions .icon-button { width: 27px; height: 27px; min-width: 27px; min-height: 27px; font-size: 13px; }
.presentation-deck-slide-actions .danger { color: #f2b8bf; }
.presentation-deck-slide-empty,
.presentation-deck-empty { color: var(--muted); font-size: 10px; line-height: 1.45; }
.presentation-deck-empty { padding: 1px 2px 2px; }
.slide-list-heading { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 8px 10px 0; }
.slide-list-heading strong { font-size: 11px; }
.slide-list-heading span { color: var(--muted); font-size: 9px; }
.slide-groups-panel { grid-template-rows: auto auto auto auto minmax(64px,1fr) auto auto; }
.slide-navigation-controller {
  min-width: 178px;
  grid-template-columns: 38px 72px 38px;
  grid-template-rows: auto 30px 36px 30px;
  grid-template-areas:
    "context context context"
    ". up ."
    "left count right"
    ". down .";
  padding: 7px 8px;
}
.slide-navigation-context { grid-area: context; width: 100%; min-width: 0; display: grid; gap: 1px; padding: 2px 5px 4px; text-align: center; }
.slide-navigation-context strong,
.slide-navigation-context small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide-navigation-context strong { color: #eef2ff; font-size: 10px; }
.slide-navigation-context small { color: var(--muted); font-size: 9px; }
@media (max-width: 720px) {
  .presentation-scope { grid-template-columns: 1fr; }
  .presentation-deck-slide-list { max-height: 142px; }
  .slide-list-heading span { display: none; }
}

/* Lattice 1.0.30 R41 Notes row comfort and always-available insertion affordance. */
.editor .block {
  min-height: 62px;
  padding-top: 12px;
  padding-bottom: 12px;
  overflow: visible;
}
.editor .block-action-handle,
html.has-touch .editor .block-action-handle {
  top: 50%;
  transform: translateY(-50%);
}
.ghost-insert-row {
  margin-top: 34px;
  margin-bottom: 44px;
  opacity: .20;
}
.ghost-insert-row:hover,
.ghost-insert-row:focus-visible,
.ghost-insert-row:focus-within {
  opacity: .82;
}



/* Lattice 1.0.31 R10 cross-page presentation deck workspace. */
.workspace-dialog.deck-tab-active { width: min(980px, calc(100vw - 24px)); }
.workspace-decks-panel { align-content: start; }
.deck-workspace-hero {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin: 2px 0 12px;
  padding: 13px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 13px;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg));
}
.deck-workspace-hero-icon {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 11px; color: color-mix(in srgb, var(--accent) 82%, white 18%);
  background: color-mix(in srgb, var(--accent) 14%, var(--panel-3));
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--line));
}
.deck-workspace-hero-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.deck-workspace-hero > div { display: grid; gap: 2px; min-width: 0; }
.deck-workspace-hero > div > strong { font-size: 14px; }
.deck-workspace-hero > div > small { color: var(--muted); font-size: 11px; line-height: 1.4; }
.deck-workspace-layout { display: grid; grid-template-columns: 218px minmax(0, 1fr); gap: 12px; min-height: 420px; }
.deck-workspace-sidebar,
.deck-workspace-main { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--bg) 68%, transparent); }
.deck-workspace-sidebar { padding: 9px; align-self: stretch; }
.deck-workspace-sidebar > header,
.deck-source-browser > header,
.deck-sequence > header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 3px 4px 8px;
}
.deck-workspace-sidebar > header span,
.deck-source-browser > header strong,
.deck-sequence > header strong { font-size: 11px; font-weight: 750; }
.deck-workspace-sidebar > header small,
.deck-source-browser > header small,
.deck-sequence > header small { color: var(--muted); font-size: 9.5px; }
.deck-workspace-list { display: grid; gap: 5px; }
.deck-workspace-card {
  width: 100%; min-height: 58px; display: grid; grid-template-columns: 28px minmax(0,1fr) 16px;
  gap: 8px; align-items: center; padding: 7px 7px; border: 1px solid transparent; border-radius: 9px;
  color: var(--text); background: transparent; text-align: left;
}
.deck-workspace-card:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.deck-workspace-card.active { border-color: color-mix(in srgb, var(--accent) 34%, var(--line)); background: color-mix(in srgb, var(--accent) 11%, transparent); }
.deck-workspace-card-icon { position: relative; width: 26px; height: 26px; }
.deck-workspace-card-icon span { position: absolute; width: 18px; height: 12px; border: 1.5px solid currentColor; border-radius: 3px; color: color-mix(in srgb, var(--accent) 72%, var(--muted)); }
.deck-workspace-card-icon span:first-child { left: 2px; top: 4px; }
.deck-workspace-card-icon span:last-child { left: 7px; top: 9px; background: color-mix(in srgb, var(--panel) 92%, transparent); }
.deck-workspace-card-copy { min-width: 0; display: grid; gap: 2px; }
.deck-workspace-card-copy strong,
.deck-workspace-card-copy small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-workspace-card-copy strong { font-size: 11.5px; }
.deck-workspace-card-copy small { color: var(--muted); font-size: 9.5px; }
.deck-workspace-card-chevron { color: var(--muted); font-size: 18px; }
.deck-workspace-list-empty { padding: 18px 8px; color: var(--muted); text-align: center; font-size: 10.5px; line-height: 1.45; }
.deck-workspace-main { padding: 14px; }
.deck-workspace-eyebrow { color: color-mix(in srgb, var(--accent) 75%, var(--text)); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.deck-composer-heading,
.deck-editor-heading { display: flex; justify-content: space-between; gap: 14px; align-items: start; margin-bottom: 12px; }
.deck-composer-heading > div,
.deck-editor-heading > div { display: grid; gap: 3px; min-width: 0; }
.deck-composer-heading h3,
.deck-editor-heading h3,
.deck-workspace-welcome h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.deck-composer-heading p,
.deck-editor-heading p,
.deck-workspace-welcome p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.deck-workspace-name-field { display: grid; gap: 5px; margin-bottom: 10px; color: var(--muted); font-size: 10px; }
.deck-workspace-name-field input {
  width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--text); font-size: 13px; font-weight: 650;
}
.deck-workspace-name-field input:focus { border-color: color-mix(in srgb, var(--accent) 58%, var(--line)); outline: 2px solid color-mix(in srgb, var(--accent) 16%, transparent); outline-offset: 1px; }
.deck-composer-summary { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; color: var(--muted); font-size: 10px; }
.deck-composer-summary strong { color: var(--text); }
.deck-composer-summary span::before { content: '·'; margin-right: 8px; color: color-mix(in srgb, var(--accent) 60%, var(--muted)); }
.deck-composer-grid,
.deck-editor-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(240px, .88fr); gap: 10px; min-height: 0; }
.deck-editor-grid { grid-template-columns: minmax(240px, .86fr) minmax(0, 1.14fr); }
.deck-source-browser,
.deck-sequence { min-width: 0; display: grid; grid-template-rows: auto minmax(0,1fr); border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--surface) 58%, transparent); overflow: hidden; }
.deck-source-browser > header,
.deck-sequence > header { padding: 9px 10px 7px; border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.deck-source-browser > header > div,
.deck-sequence > header > div { display: grid; gap: 1px; }
.deck-source-list,
.deck-sequence-list { max-height: 326px; overflow: auto; padding: 6px; scrollbar-gutter: stable; }
.deck-source-page { margin-bottom: 7px; border: 1px solid color-mix(in srgb, var(--line) 76%, transparent); border-radius: 8px; overflow: hidden; }
.deck-source-page:last-child { margin-bottom: 0; }
.deck-source-page > header { padding: 7px 8px 5px; background: color-mix(in srgb, var(--panel-3) 64%, transparent); }
.deck-source-page > header > div { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.deck-source-page > header strong { font-size: 10px; }
.deck-source-page > header small { color: var(--muted); font-size: 9px; }
.deck-source-page-slides { padding: 3px; }
.deck-source-slide {
  width: 100%; min-height: 48px; display: grid; grid-template-columns: 28px minmax(0,1fr) auto;
  gap: 8px; align-items: center; padding: 5px 6px; border: 0; border-radius: 7px;
  color: var(--text); background: transparent; text-align: left;
}
.deck-source-slide:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.deck-source-slide.selected { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.deck-source-slide:disabled { opacity: .68; cursor: default; }
.deck-source-index,
.deck-sequence-number { width: 26px; height: 26px; display: grid; place-items: center; flex: none; border-radius: 7px; color: color-mix(in srgb, var(--accent) 74%, var(--text)); background: color-mix(in srgb, var(--accent) 11%, transparent); font-size: 10px; font-weight: 800; }
.deck-source-copy,
.deck-sequence-copy { min-width: 0; display: grid; gap: 1px; }
.deck-source-copy strong,
.deck-source-copy small,
.deck-sequence-copy strong,
.deck-sequence-copy small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-source-copy strong,
.deck-sequence-copy strong { font-size: 10.5px; }
.deck-source-copy small,
.deck-sequence-copy small { color: var(--muted); font-size: 9px; }
.deck-source-action { min-width: 46px; color: color-mix(in srgb, var(--accent) 72%, var(--text)); font-size: 9px; font-weight: 750; text-align: right; }
.deck-sequence-row { min-width: 0; display: grid; grid-template-columns: 28px minmax(0,1fr) auto; gap: 7px; align-items: center; min-height: 48px; padding: 5px 4px; border-bottom: 1px solid color-mix(in srgb, var(--line) 58%, transparent); }
.deck-sequence-row:last-child { border-bottom: 0; }
.deck-sequence-actions { display: flex; gap: 2px; }
.deck-sequence-actions .icon-button { width: 28px; height: 28px; min-width: 28px; min-height: 28px; font-size: 12px; }
.deck-sequence-actions .danger { color: #f2b8bf; }
.deck-sequence-empty,
.deck-workspace-empty { min-height: 112px; display: grid; place-content: center; gap: 4px; padding: 16px; color: var(--muted); text-align: center; font-size: 10px; line-height: 1.45; }
.deck-workspace-empty strong { color: var(--text); font-size: 11px; }
.deck-composer-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); }
.deck-composer-footer span { color: var(--muted); font-size: 10px; }
.deck-workspace-welcome { min-height: 360px; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 30px; text-align: center; }
.deck-workspace-welcome p { max-width: 420px; }
.deck-workspace-welcome-art { position: relative; width: 76px; height: 56px; margin-bottom: 7px; }
.deck-workspace-welcome-art i { position: absolute; width: 48px; height: 32px; border: 1px solid color-mix(in srgb, var(--accent) 44%, var(--line)); border-radius: 8px; background: color-mix(in srgb, var(--accent) 8%, var(--panel-3)); }
.deck-workspace-welcome-art i:nth-child(1) { left: 2px; top: 2px; }
.deck-workspace-welcome-art i:nth-child(2) { left: 14px; top: 11px; }
.deck-workspace-welcome-art i:nth-child(3) { left: 26px; top: 20px; background: color-mix(in srgb, var(--accent) 14%, var(--panel-3)); }
.deck-workspace-metrics { display: flex; gap: 8px; margin: 3px 0 5px; }
.deck-workspace-metrics span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: color-mix(in srgb, var(--bg) 72%, transparent); font-size: 9.5px; }
.deck-workspace-metrics strong { color: var(--text); }
@media (max-width: 840px) {
  .workspace-dialog.deck-tab-active { width: min(760px, calc(100vw - 16px)); }
  .deck-composer-grid, .deck-editor-grid { grid-template-columns: 1fr; }
  .deck-source-list, .deck-sequence-list { max-height: 240px; }
}
@media (max-width: 660px) {
  .deck-workspace-hero { grid-template-columns: 38px minmax(0,1fr); }
  .deck-workspace-hero > .button { grid-column: 1 / -1; width: 100%; }
  .deck-workspace-layout { grid-template-columns: 1fr; min-height: 0; }
  .deck-workspace-sidebar { max-height: 170px; overflow: auto; }
  .deck-composer-heading, .deck-editor-heading { align-items: stretch; }
  .deck-composer-footer { align-items: stretch; flex-direction: column; }
  .deck-composer-footer .button { width: 100%; }
}
