:root {
  --bg: #f3f6fb;
  --panel: #fff;
  --panel-2: #f8faff;
  --text: #18283d;
  --muted: #748197;
  --line: #dce4ef;
  --accent: #367fca;
  --accent-soft: #e7f2ff;
  --danger: #c54d59;
  --grid: #e6ebf3;
  --shadow: 0 5px 18px #263d5b0b;
  --node-shadow: 0 3px 9px #24456616;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  height: 100vh;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
}

body.dark {
  --bg: #111a27;
  --panel: #192536;
  --panel-2: #202f43;
  --text: #e6edf8;
  --muted: #9eacc0;
  --line: #33445b;
  --accent: #69aaf1;
  --accent-soft: #223e5d;
  --danger: #f17c87;
  --grid: #2a3a4f;
  --shadow: 0 5px 18px #0002;
  --node-shadow: 0 3px 9px #0003;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 8px 11px;
  cursor: pointer;
  transition: background 0.15s, border 0.15s, transform 0.15s;
}

button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

button.primary:hover {
  filter: brightness(1.05);
}

button.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
}

button.full {
  width: 100%;
  margin-top: 7px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.topbar {
  height: 66px;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 190px;
}

.brandmark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 27px;
}

.brand b {
  display: block;
  font-size: 17px;
  letter-spacing: -0.4px;
}

.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 1.3px;
  color: var(--muted);
  margin-top: 3px;
}

.project-name {
  min-width: 170px;
  max-width: 310px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.project-name input {
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 650;
  font-size: 14px;
  padding: 3px 0;
  width: 100%;
  outline: none;
}

.project-name small {
  font-size: 10px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-actions > button {
  min-width: 35px;
}

.top-actions i,
.canvas-tools i {
  height: 25px;
  border-left: 1px solid var(--line);
  margin: 0 4px;
}

.export-wrap {
  position: relative;
}

.export-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 220px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 6px;
  border-radius: 10px;
  z-index: 30;
}

.export-menu button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
}

.hidden {
  display: none !important;
}

/* Shape ribbon */

.ribbon {
  height: 82px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.ribbon-title {
  width: 115px;
  flex-shrink: 0;
}

.ribbon-title b {
  display: block;
  letter-spacing: 1.2px;
  font-size: 10px;
}

.ribbon-title small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 5px;
}

.shape-list {
  display: flex;
  gap: 5px;
  align-items: center;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 3px;
}

.shape-list button {
  min-width: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 8px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
  font-size: 10px;
}

.shape-list button:hover,
.shape-list button.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #b9d9fb;
}

.shape-sample {
  height: 22px;
  min-width: 30px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 18px;
}

.shape-sample.pill {
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  width: 33px;
  font-size: 9px;
}

.shape-sample.rect {
  font-size: 20px;
}

.shape-sample.diamond {
  font-size: 24px;
}

.shape-sample.io {
  font-size: 25px;
}

.shape-sample.doc,
.shape-sample.sub,
.shape-sample.db,
.shape-sample.manual,
.shape-sample.delay,
.shape-sample.conn,
.shape-sample.note,
.shape-sample.hex {
  font-size: 22px;
}

.ribbon-tools {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Main workspace */

.workspace {
  height: calc(100vh - 148px);
  display: grid;
  grid-template-columns: 255px minmax(360px, 1fr) 285px;
  gap: 10px;
  padding: 10px;
  min-height: 0;
  position: relative;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.tree-panel,
.inspector-panel {
  display: flex;
  flex-direction: column;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 12px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 9px;
  letter-spacing: 1.25px;
  font-weight: 800;
}

.panel h2 {
  font-size: 15px;
  letter-spacing: -0.3px;
  margin: 5px 0 0;
}

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 18px;
}

/* Hierarchy panel */

.tree-actions {
  display: flex;
  gap: 6px;
  padding: 9px 11px 0;
}

.tree-actions button {
  flex: 1;
  font-size: 11px;
  padding: 8px 7px;
}

.tree-caption {
  display: flex;
  justify-content: space-between;
  padding: 17px 14px 7px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 750;
}

.tree-caption span {
  letter-spacing: 0;
  font-weight: 500;
}

.node-tree {
  overflow: auto;
  padding: 4px 8px 12px;
  flex: 1;
  min-height: 100px;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 5px;
  border-radius: 7px;
  min-height: 31px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
}

.tree-row:hover {
  background: var(--panel-2);
}

.tree-row.selected {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.tree-toggle {
  width: 17px;
  flex-shrink: 0;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.tree-symbol {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--accent);
  font-size: 10px;
  flex-shrink: 0;
  background: var(--panel);
}

.tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.tree-empty {
  padding: 18px 10px;
  color: var(--muted);
  line-height: 1.6;
}

.panel-foot {
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}

.panel-foot b {
  font-size: 11px;
}

.panel-foot p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin: 7px 0;
}

.panel-foot button {
  font-size: 11px;
}

/* Canvas editor */

.editor-panel {
  display: flex;
  flex-direction: column;
}

.canvas-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}

.canvas-head h2 {
  font-size: 15px;
  margin: 4px 0 0;
}

.canvas-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.canvas-tools button {
  padding: 6px 10px;
  min-width: 32px;
}

.canvas-tools #zoomLabel {
  min-width: 42px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.toggle.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #b9d9fb;
}

.canvas {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-2);
  touch-action: none;
}

.canvas svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  outline: none;
  touch-action: none;
}

.canvas svg.dragging {
  cursor: grabbing;
}

.canvas.hide-grid #canvasBackground {
  opacity: 0;
}

.canvas-status {
  height: 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
  gap: 10px;
}

.canvas-status #selectionStatus {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 35%;
}

/* Flowchart nodes and edges */

.node-shape {
  filter: drop-shadow(var(--node-shadow));
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}

.node-group {
  cursor: move;
  outline: none;
}

.node-group.selected .node-shape {
  stroke: var(--accent) !important;
  stroke-width: 2.7;
  filter: drop-shadow(
    0 0 3px color-mix(in srgb, var(--accent) 45%, transparent)
  );
}

.node-group:focus-visible .node-shape {
  stroke: var(--accent);
  stroke-width: 3;
}

.node-text {
  pointer-events: none;
  user-select: none;
}

.edge-path {
  fill: none;
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
  opacity: 0.95;
}

.edge-label {
  font-size: 11px;
  fill: var(--muted);
  paint-order: stroke;
  stroke: var(--panel-2);
  stroke-width: 4px;
  stroke-linejoin: round;
}

/* Empty canvas state */

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 25px;
  pointer-events: none;
}

.empty-state > * {
  pointer-events: auto;
}

.empty-icon {
  font-size: 42px;
  color: var(--accent);
  background: var(--accent-soft);
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  border-radius: 20px;
}

.empty-state h3 {
  font-size: 18px;
  margin: 15px 0 5px;
}

.empty-state p {
  max-width: 320px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0 0 14px;
}

/* Toast notifications */

.toast {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 20px);
  padding: 9px 14px;
  background: #17283e;
  color: white;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 5;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Inspector panel */

.inspector-empty {
  padding: 30px 18px;
  text-align: center;
  color: var(--muted);
}

.inspector-empty-icon {
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: var(--panel-2);
  color: var(--accent);
  font-size: 27px;
}

.inspector-empty h3 {
  color: var(--text);
  font-size: 14px;
  margin: 0 0 8px;
}

.inspector-empty p {
  font-size: 11px;
  line-height: 1.6;
  margin: 0;
}

.inspector-content {
  overflow: auto;
  flex: 1;
}

.inspector-section {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-heading h3 {
  font-size: 12px;
  margin: 0;
}

.section-number {
  font-size: 10px;
  color: var(--muted);
}

.inspector-section label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  margin: 11px 0 6px;
}

.inspector-section textarea,
.inspector-section select,
.inspector-section input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 7px;
  padding: 8px;
  font-size: 12px;
}

.inspector-section textarea {
  resize: vertical;
  min-height: 65px;
  line-height: 1.45;
}

.inspector-section input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.inspector-section input[type="color"] {
  width: 100%;
  height: 34px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  cursor: pointer;
}

.hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 5px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

/* Settings dialog */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: #0b1728a6;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.dialog {
  width: min(430px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 0 16px;
  box-shadow: 0 20px 60px #0003;
}

.dialog > label,
.dialog > select {
  display: block;
  margin-left: 18px;
  margin-right: 18px;
  width: calc(100% - 36px);
}

.dialog > label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-top: 16px;
  margin-bottom: 7px;
}

.dialog > select {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
}

.dialog > .full {
  width: calc(100% - 36px);
  margin: 18px;
}

/* Collapsible side panels */

.workspace.tree-collapsed {
  grid-template-columns: 44px minmax(360px, 1fr) 285px;
}

.workspace.inspector-collapsed {
  grid-template-columns: 255px minmax(360px, 1fr) 44px;
}

.workspace.tree-collapsed.inspector-collapsed {
  grid-template-columns: 44px minmax(360px, 1fr) 44px;
}

.tree-collapsed #hierarchyPanel .panel-head > div,
.tree-collapsed #hierarchyPanel .tree-actions,
.tree-collapsed #hierarchyPanel .tree-caption,
.tree-collapsed #hierarchyPanel .node-tree,
.tree-collapsed #hierarchyPanel .panel-foot {
  display: none;
}

.tree-collapsed #hierarchyPanel .panel-head {
  padding: 12px 7px;
  justify-content: center;
}

.tree-collapsed #collapseHierarchyPanelBtn {
  transform: rotate(180deg);
}

.inspector-collapsed #inspectorPanel .panel-head > div,
.inspector-collapsed #inspectorPanel > .inspector-empty,
.inspector-collapsed #inspectorPanel > .inspector-content,
.inspector-collapsed #inspectorPanel > .panel-foot {
  display: none;
}

.inspector-collapsed #inspectorPanel .panel-head {
  padding: 12px 7px;
  justify-content: center;
}

.inspector-collapsed #collapseInspectorPanelBtn {
  transform: rotate(180deg);
}

/* Responsive layout */

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 220px minmax(300px, 1fr) 250px;
  }

  .brand {
    min-width: 150px;
  }

  .topbar {
    gap: 12px;
    padding: 0 10px;
  }

  .top-actions {
    gap: 4px;
  }

  .top-actions button {
    padding: 7px;
  }

  .ribbon {
    gap: 6px;
    padding: 8px;
  }

  .ribbon-title {
    width: 90px;
  }

  .shape-list button {
    min-width: 65px;
  }
}

@media (max-width: 850px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .topbar {
    height: auto;
    min-height: 62px;
    flex-wrap: wrap;
    padding: 10px;
  }

  .project-name {
    order: 3;
    max-width: none;
    flex-basis: 100%;
  }

  .top-actions {
    margin-left: auto;
    flex-wrap: wrap;
  }

  .ribbon {
    height: auto;
    min-height: 80px;
    flex-wrap: wrap;
  }

  .shape-list {
    order: 3;
    flex-basis: 100%;
  }

  .ribbon-title {
    width: auto;
  }

  .workspace,
  .workspace.tree-collapsed,
  .workspace.inspector-collapsed,
  .workspace.tree-collapsed.inspector-collapsed {
    height: auto;
    min-height: calc(100vh - 160px);
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(480px, 65vh) auto;
  }

  .tree-panel {
    max-height: 340px;
  }

  .inspector-panel {
    max-height: none;
  }

  .tree-collapsed #hierarchyPanel .panel-head > div,
  .inspector-collapsed #inspectorPanel .panel-head > div {
    display: block;
  }

  .tree-collapsed #hierarchyPanel .tree-actions,
  .tree-collapsed #hierarchyPanel .tree-caption,
  .tree-collapsed #hierarchyPanel .node-tree,
  .tree-collapsed #hierarchyPanel .panel-foot {
    display: initial;
  }

  .inspector-collapsed #inspectorPanel > .inspector-content,
  .inspector-collapsed #inspectorPanel > .inspector-empty,
  .inspector-collapsed #inspectorPanel > .panel-foot {
    display: block;
  }

  .canvas-status span:last-child {
    display: none;
  }
}

/* Print layout */

@media print {
  body {
    overflow: visible;
    background: white;
  }

  .topbar,
  .ribbon,
  .tree-panel,
  .inspector-panel,
  .canvas-head,
  .canvas-status {
    display: none !important;
  }

  .workspace {
    display: block;
    height: auto;
    padding: 0;
  }

  .editor-panel {
    border: 0;
    box-shadow: none;
    height: 95vh;
  }

  .canvas {
    background: white;
  }

  .canvas svg {
    width: 100%;
    height: 100%;
  }

  .node-control,
  .selection-marquee {
    display: none !important;
  }

  #diagram {
    background: #fff !important;
  }

  .canvas {
    overflow: visible !important;
  }

  .editor-panel {
    height: 95vh !important;
  }

  body > *:not(#printExport) {
    display: none !important;
  }

  #printExport {
    display: block !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  #printExport svg {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    background: #fff !important;
  }

  @page {
    size: auto;
    margin: 12mm;
  }
}

/* Node controls and selection */

.node-control {
  cursor: pointer;
  pointer-events: all;
}

.node-control circle {
  fill: var(--panel);
  stroke: var(--accent);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 2px #0002);
}

.node-control path {
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  fill: none;
  vector-effect: non-scaling-stroke;
}

.node-control:hover circle {
  fill: var(--accent-soft);
  stroke-width: 2.4;
}

.collapse-control circle {
  stroke: var(--danger);
}

.collapse-control path {
  stroke: var(--danger);
}

.selection-marquee {
  fill: #5aa3f533;
  stroke: #2f83dc;
  stroke-width: 1.5;
  stroke-dasharray: 5 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* Resizable side panels */

.panel-resizer {
  position: absolute;
  z-index: 8;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
  transform: translateX(-50%);
}

.panel-resizer::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 45%;
  height: 54px;
  width: 3px;
  border-radius: 4px;
  background: var(--line);
  transition: background 0.15s;
}

.panel-resizer:hover::after,
.panel-resizer:active::after {
  background: var(--accent);
}

/* Print export */

.print-export {
  display: none;
}



/* Added page setup, text formatting, document tabs and template controls */
.page-toolbar {
  display:flex; align-items:end; gap:10px; flex-wrap:wrap;
  padding:10px 14px; background:var(--panel); border-bottom:1px solid var(--line);
  max-height:22vh; overflow:auto;
}
.page-toolbar label { display:flex; flex-direction:column; gap:4px; color:var(--muted); font-size:11px; font-weight:700; }
.page-toolbar input[type="number"] { width:82px; min-width:72px; }
.page-toolbar input[type="color"] { width:48px; height:34px; padding:2px; }
.page-toolbar select { min-width:90px; }
.document-tabs { display:flex; align-items:center; gap:4px; flex-wrap:wrap; flex-basis:100%; }
.document-tab-wrap { display:inline-flex; align-items:center; border:1px solid var(--line); border-radius:7px; overflow:hidden; }
.document-tab { border:0; border-radius:0; padding:6px 10px; }
.document-tab.active { background:var(--accent-soft); border-color:var(--accent); color:var(--text); }
.document-close { border:0; border-left:1px solid var(--line); border-radius:0; padding:5px 8px; }
.format-toolbar { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin:10px 0; padding:10px; border:1px solid var(--line); border-radius:8px; }
.format-toolbar label { display:flex; flex-direction:column; gap:4px; font-size:11px; color:var(--muted); }
.format-toolbar .check-option { flex-direction:row; align-items:center; gap:6px; color:var(--text); font-size:12px; }
.format-toolbar input[type="checkbox"] { width:auto; }
#settingsDialog .dialog { max-height:88vh; overflow:auto; }
#settingsDialog input[type="text"], #settingsDialog textarea { width:100%; }
#settingsDialog h3 { margin:14px 0 8px; }
#settingsDialog hr { border:0; border-top:1px solid var(--line); margin:16px 0; }
@media (max-width: 900px) {
  .page-toolbar { max-height:30vh; }
  .page-toolbar label { flex:1 1 100px; }
  .format-toolbar { grid-template-columns:1fr 1fr; }
}

/* Modern, functional theme and adaptive workspace refinements */
html[data-theme="dark"] body,
body.dark {
  --bg: #101722;
  --panel: #172231;
  --panel-2: #1d2b3d;
  --text: #e8eef8;
  --muted: #a0aec2;
  --line: #34445a;
  --accent: #78b7ff;
  --accent-soft: #233e5d;
  --danger: #ff8994;
  --grid: #2a3b50;
  --shadow: 0 10px 30px #0003;
  --node-shadow: 0 3px 9px #0004;
  background: var(--bg);
  color: var(--text);
}

html[data-theme="light"] body {
  --bg: #f2f6fc;
  --panel: #ffffff;
  --panel-2: #f7faff;
  --text: #17263b;
  --muted: #718098;
  --line: #dce5f0;
  --accent: #2878d0;
  --accent-soft: #e5f1ff;
  --danger: #c94455;
  --grid: #e5ebf4;
}

body { display: flex; flex-direction: column; min-height: 0; }
.topbar { flex: 0 0 66px; }
.ribbon { flex: 0 0 82px; }
.page-toolbar { flex: 0 0 auto; max-height: 25vh; overflow: auto; }
.workspace {
  height: auto;
  flex: 1 1 0;
  min-height: 180px;
  grid-template-columns: var(--left-panel-width, 255px) minmax(280px, 1fr) var(--right-panel-width, 285px);
  gap: 10px;
  overflow: hidden;
  padding: 10px 12px 12px;
}
.panel { border-radius: 15px; box-shadow: 0 8px 28px color-mix(in srgb, var(--text) 7%, transparent); }
.canvas { background: var(--panel-2); transition: background-color .18s ease; }
.canvas svg { user-select: none; }
.canvas-head { background: color-mix(in srgb, var(--panel) 92%, var(--accent) 8%); }
.page-toolbar { border-radius: 0 0 12px 12px; box-shadow: 0 4px 14px #1c35500a; }
.page-toolbar input, .page-toolbar select, #settingsDialog input, #settingsDialog select, #settingsDialog textarea {
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
}
.page-toolbar input[type="color"] { padding: 3px; }
.panel-resizer { z-index: 20; top: 10px; bottom: 12px; width: 12px; transform: none; border-radius: 8px; }
.panel-resizer-left { left: calc(var(--left-panel-width, 255px) + 7px); }
.panel-resizer-right { right: calc(var(--right-panel-width, 285px) + 7px); }
.panel-resizer::after { left: 4px; top: calc(50% - 25px); height: 50px; width: 4px; background: var(--line); }
.panel-resizer:hover { background: var(--accent-soft); }
.workspace.is-resizing, .workspace.is-resizing * { cursor: col-resize !important; user-select: none !important; }
.export-menu { z-index: 1000; }
#settingsDialog { color: var(--text); background: transparent; border: 0; padding: 0; max-width: min(680px, calc(100vw - 24px)); }
#settingsDialog::backdrop { background: #07142688; backdrop-filter: blur(4px); }
#settingsDialog .dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 25px 90px #0004; padding: 24px; }
#settingsDialog h3 { color: var(--text); }
#settingsDialog label { color: var(--muted); }
#printExport { display: none; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(190px, 230px) minmax(280px, 1fr) minmax(220px, 250px); }
  .topbar { gap: 10px; padding: 0 10px; }
  .brand { min-width: 150px; }
  .top-actions { gap: 4px; }
}
@media (max-width: 850px) {
  body { height: auto; min-height: 100vh; overflow: auto; display: block; }
  .topbar { height: auto; min-height: 66px; flex-wrap: wrap; padding: 10px; }
  .top-actions { flex-wrap: wrap; }
  .ribbon { height: auto; min-height: 82px; }
  .page-toolbar { max-height: none; }
  .workspace { height: auto; display: flex; flex-direction: column; overflow: visible; }
  .tree-panel, .inspector-panel { min-height: 230px; }
  .editor-panel { min-height: 55vh; }
  .panel-resizer { display: none; }
}
@media print {
  body { display: block !important; height: auto !important; overflow: visible !important; background: white !important; }
  body > *:not(#printExport) { display: none !important; }
  #printExport { display: block !important; position: static !important; width: 100% !important; height: auto !important; padding: 0 !important; margin: 0 !important; background: white !important; }
  #printExport svg { display: block !important; width: 100% !important; height: auto !important; max-height: 95vh !important; page-break-inside: avoid; }
  @page { margin: 10mm; }
}

/* ---- organize panel & template picker ---- */
.organize .org-label{font-size:11px;letter-spacing:.06em;text-transform:uppercase;opacity:.7;margin:10px 0 4px}
.org-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.org-grid.two{grid-template-columns:1fr 1fr}
.org-grid button{padding:7px 4px;font-size:13px}
.tpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:10px;margin-top:12px}
.tpl-grid button{display:flex;flex-direction:column;align-items:flex-start;gap:4px;padding:12px;text-align:left}
.tpl-grid small{opacity:.7}

.pop{position:fixed;z-index:60;display:none;flex-direction:column;gap:8px;padding:12px 14px;min-width:200px;background:var(--panel);border:1px solid var(--line);border-radius:10px;box-shadow:var(--shadow)}
.pop.open{display:flex}.pop label{display:flex;gap:8px;align-items:center}
#shapeCategory{margin-right:6px}

/* ======== v3: theme-aware controls ======== */
:root { --on-accent: #ffffff; color-scheme: light; }
body.dark { --on-accent: #08233f; color-scheme: dark; }
button.primary { color: var(--on-accent); }
button, select, input, textarea { font-family: inherit; }
button { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
button:hover:not(:disabled):not(.primary) { background: var(--accent-soft); border-color: var(--accent); }
button:disabled { opacity: .45; }
button.active, button.toggle.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
select, textarea, input[type=text], input[type=number], input[type=search] { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
select option { background: var(--panel); color: var(--text); }
input[type=color] { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px; height: 30px; width: 100%; cursor: pointer; }
input[type=checkbox], input[type=range] { accent-color: var(--accent); }
.ribbon-tools select { height: 34px; margin-right: 6px; max-width: 150px; }
.dialog, .pop, .toast { background: var(--panel); color: var(--text); }
.tpl-grid button, .slide-card, .slide-add { color: var(--text); }
.panel-head h2, .eyebrow, label { color: inherit; }
.eyebrow { color: var(--accent); }
label { color: var(--muted); }

/* ======== inspector ======== */
.inspector-body { padding: 8px 10px 16px; overflow: auto; flex: 1; min-height: 0; }
.inspector-body details { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--panel); }
.inspector-body summary { cursor: pointer; padding: 9px 12px; font-weight: 700; font-size: 12px; letter-spacing: .03em; list-style: none; color: var(--text); }
.inspector-body summary::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--accent); transition: transform .15s; }
.inspector-body details[open] > summary::before { transform: rotate(90deg); }
.sec-body { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; padding: 4px 12px 12px; }
.f { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); min-width: 0; }
.f.full { grid-column: 1 / -1; }
.f.chk { flex-direction: row; align-items: center; gap: 7px; font-weight: 500; color: var(--text); }
.f input[type=number], .f input[type=text], .f select, .f textarea { width: 100%; font-weight: 500; }
.f output { float: right; color: var(--text); }
.act-row { display: flex; gap: 6px; margin-bottom: 8px; } .act-row button { flex: 1; padding: 8px 6px; }
.org-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; margin-top: 4px; }
.org-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } .org-grid.two { grid-template-columns: 1fr 1fr; }
.org-grid button { padding: 7px 4px; font-size: 12px; }
.hint { font-size: 11px; color: var(--muted); padding: 4px 4px 0; line-height: 1.5; }

/* ======== outline panel ======== */
.tree-tools { display: flex; gap: 6px; padding: 10px 12px 6px; flex-wrap: wrap; } .tree-tools button { padding: 7px 9px; }
.tree-tools .primary { flex: 1; }
.tree-search { margin: 0 12px 6px; width: calc(100% - 24px); }
.tree-row { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; background: transparent; }
.tree-row:hover { background: var(--accent-soft); } .tree-row.selected { background: var(--accent-soft); border-color: var(--accent); }
.tree-row button { border: 0; background: transparent; padding: 2px 4px; color: var(--text); }
.tree-caret { width: 18px; color: var(--muted) !important; } .tree-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tree-swatch { width: 12px; height: 12px; border-radius: 3px; border: 1.5px solid; flex: none; }
.tree-acts { display: none; gap: 0; } .tree-row:hover .tree-acts { display: flex; } .tree-acts button { font-size: 12px; }

/* ======== canvas tools, slides, present ======== */
.pan-pad { display: inline-flex; gap: 2px; } .pan-pad button { padding: 4px 7px; font-size: 11px; }
#canvas.pan-tool, #canvas.pan-tool svg { cursor: grab; }
.slide-strip { display: flex; gap: 10px; padding: 8px 12px; overflow-x: auto; border-top: 1px solid var(--line); background: var(--panel-2); flex: none; min-height: 118px; align-items: stretch; }
.slide-card { position: relative; flex: none; width: 140px; border: 2px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer; overflow: hidden; }
.slide-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.slide-thumb { display: block; line-height: 0; padding: 3px; } .slide-thumb svg { width: 100%; height: auto; border-radius: 4px; }
.slide-meta { display: flex; gap: 6px; padding: 3px 8px 5px; font-size: 11px; align-items: baseline; } .slide-meta b { color: var(--accent); } .slide-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.slide-acts { position: absolute; top: 3px; right: 3px; display: none; gap: 2px; } .slide-card:hover .slide-acts { display: flex; } .slide-acts button { padding: 1px 5px; font-size: 10px; }
.slide-add { flex: none; width: 90px; border: 2px dashed var(--line); border-radius: 10px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 20px; color: var(--accent); }
.slide-add span { font-size: 11px; color: var(--muted); }
.present { position: fixed; inset: 0; background: #000; z-index: 200; display: grid; place-items: center; } .present-n { position: fixed; bottom: 10px; left: 0; right: 0; text-align: center; color: #fff9; font-size: 12px; pointer-events: none; }

/* ======== template picker, settings tabs ======== */
.dialog.wide { width: min(900px, 94vw); max-height: 88vh; overflow: auto; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 14px; }
.tpl-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px; text-align: left; border-radius: 12px; }
.tpl-thumb { width: 100%; line-height: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); min-height: 90px; display: grid; place-items: center; background: var(--panel-2); }
.tpl-thumb svg { width: 100%; height: auto; } .tpl-blank { font-size: 34px; color: var(--accent); } .tpl-card small { color: var(--muted); }
.tabs-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tabs-nav button { padding: 7px 12px; border-radius: 999px; }
.tab-pane { display: none; } .tab-pane.active { display: block; }
.tab-pane > label { display: block; margin: 12px 0 4px; font-weight: 600; font-size: 12px; }
.tab-pane > select, .tab-pane > input[type=text], .tab-pane > input[type=number], .tab-pane > textarea { width: 100%; }
.tab-pane > h3 { display: none; } .tab-pane > button.full { margin-top: 12px; width: 100%; }
.shortcuts { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; font-size: 12px; margin-top: 10px; } .shortcuts span:nth-child(odd) { font-weight: 700; color: var(--accent); }
.pop { box-shadow: var(--shadow); }

#settingsDialog { max-width: none !important; width: 100%; background: #0b1728a6 !important; }
#settingsDialog .dialog { width: min(600px, 94vw); }

/* ======== v4: compact ribbon ======== */
.ribbon, .page-toolbar { display: none !important; }
.ribbon2 { background: var(--panel); border-bottom: 1px solid var(--line); position: relative; flex: none; }
.rtabs { display: flex; align-items: center; gap: 2px; padding: 4px 10px 0; border-bottom: 1px solid var(--line); min-height: 32px; }
.rtabs > button { border: 0; background: transparent; padding: 6px 14px; border-radius: 8px 8px 0 0; font-weight: 600; color: var(--muted); }
.rtabs > button.active { background: var(--panel-2); color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.rtabs .document-tabs { margin-left: auto; display: flex; gap: 4px; overflow-x: auto; max-width: 55%; }
.rbody { background: var(--panel-2); overflow-x: auto; }
.rpane { display: none; align-items: stretch; padding: 6px 10px; gap: 0; min-height: 78px; } .rpane.active { display: flex; }
.rg { display: flex; flex-direction: column; justify-content: space-between; padding: 0 10px; border-right: 1px solid var(--line); flex: none; }
.rg:first-child { padding-left: 0; } .rg-name { font-size: 10px; color: var(--muted); text-align: center; padding-top: 2px; white-space: nowrap; }
.rg-body { display: flex; gap: 6px; align-items: stretch; flex: 1; } .rg-body.col2 { flex-direction: column; justify-content: center; gap: 5px; }
.rg .row { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; } .rg .col { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.rg button, .rg select, .rg input[type=number] { height: 28px; padding: 0 8px; font-size: 12px; white-space: nowrap; }
.rg button.big { height: auto; min-width: 58px; flex-direction: column; display: flex; align-items: center; justify-content: center; gap: 2px; padding: 4px 8px; line-height: 1.15; }
.rg button.big b { font-size: 20px; font-weight: 400; } .rg button.tall { height: auto; padding: 0 6px; }
.rg .clr { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 700; color: var(--text); margin: 0; }
.rg .clr input[type=color] { width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); }
.rg label { margin: 0; display: flex; gap: 4px; align-items: center; font-size: 12px; white-space: nowrap; color: var(--muted); }
.w50 { width: 56px !important; } .w70 { width: 74px !important; } .zs { width: 120px; }
.rg select { max-width: 150px; } .rg .filebtn { cursor: pointer; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); }
.gallery { display: grid; grid-template-rows: repeat(2, 30px); grid-auto-flow: column; grid-auto-columns: 38px; gap: 3px; overflow-x: auto; max-width: 300px; align-content: center; }
.gallery.wide { max-width: 520px; } .shp { padding: 0; width: 36px; height: 30px; display: grid; place-items: center; border-radius: 6px; } .shp svg { pointer-events: none; }
.gallery-pop { width: 330px; max-height: 300px; overflow: auto; display: none; flex-wrap: wrap; flex-direction: row; gap: 4px; padding: 10px; } .gallery-pop.open { display: flex; }
.rg button.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.ctx { position: fixed; z-index: 300; min-width: 230px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 40px #0005; padding: 5px; font-size: 13px; }
.ctx.sub { position: absolute; left: 100%; top: -6px; display: none; } .ctx-item { position: relative; display: flex; justify-content: space-between; gap: 18px; padding: 7px 12px; border-radius: 7px; cursor: pointer; }
.ctx-item:hover { background: var(--accent-soft); } .ctx-item:hover > .ctx.sub { display: block; } .ctx-item em { font-style: normal; color: var(--muted); font-size: 11px; } .ctx-item.off { opacity: .4; pointer-events: none; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }
/* denser side panels */
.inspector-body { padding: 6px 8px 12px; } .inspector-body details { margin-bottom: 6px; } .inspector-body summary { padding: 7px 10px; }
.sec-body { gap: 6px 8px; padding: 2px 10px 10px; } .f input, .f select, .f textarea { padding: 4px 6px; font-size: 12px; }
.tree-tools { padding: 8px 10px 4px; } .tree-row { padding: 2px 6px; } .panel-head { padding-top: 10px; padding-bottom: 8px; }
.workspace { gap: 8px; padding: 8px; }

.rg { padding: 0 8px; } .rg button, .rg select { padding: 0 6px; } .rg select { max-width: 112px; } #fmtFit { max-width: 128px; } #fmtFont { max-width: 84px; }
.gallery { max-width: 232px; } .rpane[data-pane="shape"] .rg-body.col2 .row { gap: 6px; }

/* ---- v5: tree guide lines, compact slide strip, panel toggles ---- */
.node-tree { gap: 0 !important; }
.tree-row { padding: 0 6px 0 4px !important; gap: 4px; min-height: 26px; border-radius: 6px; }
.tg { position: relative; flex: none; width: 14px; align-self: stretch; }
.tg.vert::before, .tg.tee::before, .tg.last::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; border-left: 1px solid var(--muted); opacity: .55; }
.tg.last::before { bottom: 50%; }
.tg.tee::after, .tg.last::after { content: ""; position: absolute; left: 6px; right: -2px; top: 50%; border-top: 1px solid var(--muted); opacity: .55; }
.tree-row.selected .tg::before, .tree-row.selected .tg::after { opacity: .9; }
.slide-strip { min-height: 0 !important; padding: 5px 10px !important; gap: 6px !important; align-items: center !important; }
.slide-card { width: auto !important; min-width: 64px; display: flex; flex-direction: column; align-items: center; border-width: 1.5px; border-radius: 8px; }
.slide-thumb { padding: 2px !important; } .slide-thumb svg { width: auto !important; height: 46px !important; max-width: 120px; display: block; }
.slide-meta { padding: 0 6px 2px !important; font-size: 10px !important; gap: 4px !important; max-width: 110px; }
.slide-add { width: 54px !important; height: 62px; font-size: 18px !important; border-width: 1.5px !important; } .slide-add span { font-size: 9px !important; }
.pcluster { display: flex; gap: 3px; margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--line); }
.pcluster button { width: 30px; height: 24px; padding: 0; display: grid; place-items: center; border-radius: 6px; color: var(--muted); background: transparent; border-color: transparent; font-size: 14px; }
.pcluster button.on { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.pcluster button:hover { border-color: var(--accent); }

/* ---- v6: per-panel toggles, strip header, slide show ---- */
#canvasPanel { position: relative; }
.edge-tab { position: absolute; top: 50%; transform: translateY(-50%); z-index: 6; writing-mode: vertical-rl; padding: 12px 5px; font-size: 12px; font-weight: 700; color: var(--accent); background: var(--panel); border: 1px solid var(--accent); box-shadow: var(--shadow); }
.edge-tab.left { left: 0; border-radius: 0 10px 10px 0; border-left: 0; } .edge-tab.right { right: 0; border-radius: 10px 0 0 10px; border-right: 0; }
.rt-right { display: flex; gap: 4px; margin-left: 8px; } .rt-btn { width: 30px; height: 26px; padding: 0; display: grid; place-items: center; border-radius: 6px; font-size: 15px; color: var(--muted); }
.rt-btn:hover, #pcFocus.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.strip-wrap { flex: none; border-top: 1px solid var(--line); background: var(--panel-2); }
.strip-head { display: flex; align-items: center; gap: 8px; padding: 3px 10px; min-height: 28px; } .strip-head .sp { flex: 1; } .strip-head button { height: 22px; padding: 0 9px; font-size: 11px; }
.slide-strip { border-top: 0 !important; }
.sorter { width: min(1000px, 94vw); } .sorter-act { display: flex; gap: 8px; align-items: center; }
.sorter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; padding: 6px 4px 14px; }
.sorter-card { position: relative; border: 2px solid var(--line); border-radius: 10px; background: var(--panel); cursor: grab; overflow: hidden; }
.sorter-card.active { border-color: var(--accent); } .sorter-card.over { outline: 3px dashed var(--accent); } .sorter-card.drag { opacity: .4; }
.sorter-card:hover .slide-acts { display: flex; } .sorter-card .slide-thumb svg { width: 100%; height: auto; max-height: 150px; }
.slideshow { position: fixed; inset: 0; z-index: 500; background: #000; color: #fff; outline: none; overflow: hidden; }
.slideshow.idle { cursor: none; } .slideshow.nocursor, .slideshow.nocursor * { cursor: none !important; }
.show-stage, .show-slide { position: absolute; inset: 0; } .show-slide { display: grid; place-items: center; will-change: transform, opacity; }
.show-ink { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; }
.show-laser { position: fixed; z-index: 9; display: none; width: 22px; height: 22px; border-radius: 50%; pointer-events: none; transform: translate(-50%, -50%); background: radial-gradient(circle, #ff3030 0 30%, #ff303088 32% 55%, transparent 70%); box-shadow: 0 0 14px 4px #ff303088; }
.show-blank { position: absolute; inset: 0; z-index: 7; } .show-end { position: absolute; inset: 0; z-index: 8; background: #000; display: grid; place-items: center; font-size: 22px; color: #bbb; }
.show-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 6; background: #ffffff22; } .show-progress i { display: block; height: 100%; background: #e9604d; transition: width .3s; }
.show-bar { position: absolute; left: 14px; bottom: 14px; z-index: 10; display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 999px; background: #1f2530e6; box-shadow: 0 4px 20px #0008; opacity: 0; transition: opacity .25s; }
.slideshow.active .show-bar, .show-bar:hover { opacity: 1; } .show-bar button { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 0; background: transparent; color: #fff; font-size: 14px; }
.show-bar button:hover { background: #ffffff22; } .show-bar button.on { background: #e9604d; } .show-bar i { width: 1px; height: 18px; background: #ffffff44; margin: 0 4px; } .show-count { font-size: 12px; padding: 0 6px; color: #ddd; }
.show-bar input[type=color] { width: 24px; height: 24px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: transparent; }
.show-all { position: absolute; inset: 0; z-index: 12; background: #000d; overflow: auto; padding: 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; align-content: start; }
.show-thumb { position: relative; padding: 4px; border: 2px solid #ffffff33; border-radius: 8px; background: #111; color: #fff; line-height: 0; } .show-thumb.on { border-color: #e9604d; } .show-thumb:hover { border-color: #fff; }
.show-thumb svg { width: 100%; height: auto; } .show-thumb span { position: absolute; left: 8px; bottom: 6px; line-height: 1; font-size: 12px; background: #000a; padding: 2px 6px; border-radius: 4px; }
.slideshow [hidden], .show-end[hidden], .show-all[hidden], .show-blank[hidden] { display: none !important; }

/* Workspace with no open document: template chooser fills the canvas */
.nodoc { position: absolute; inset: 0; z-index: 30; overflow: auto; background: var(--panel); display: flex; justify-content: center; align-items: flex-start; padding: 28px; }
.nodoc[hidden] { display: none; }
.nodoc-inner { width: 100%; max-width: 1000px; margin: auto; text-align: center; }
.nodoc-inner .tpl-grid { text-align: left; }
.nodoc-inner p { color: var(--muted); margin: 4px 0 0; }
