    :root {
      --ink: #1a2233;
      --muted: #6b7386;
      --line: #e3e8f0;
      --line-strong: #cdd6e4;
      --panel: rgba(255, 255, 255, .96);
      --soft: #f4f7fb;
      --accent: #2563eb;
      --accent-deep: #1d4fd8;
      --accent-soft: #eef4ff;
      --green: #00a889;
      --red: #e55353;
      --yellow: #f5b83b;
      --radius: 10px;
      --radius-sm: 8px;
      --shadow-sm: 0 1px 2px rgba(23, 32, 55, .05), 0 2px 8px rgba(23, 32, 55, .05);
      --shadow-md: 0 4px 14px rgba(23, 32, 55, .08), 0 12px 32px rgba(23, 32, 55, .08);
      --shadow: 0 16px 38px rgba(24, 32, 51, .14);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      height: 100vh;
      color: var(--ink);
      font-size: 13px;
      font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
      background: #eef1f6;
      overflow: hidden;
      -webkit-font-smoothing: antialiased;
    }

    ::-webkit-scrollbar { width: 8px; height: 8px; }
    ::-webkit-scrollbar-thumb { background: #c6cfdd; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
    ::-webkit-scrollbar-thumb:hover { background: #aab6c9; border: 2px solid transparent; background-clip: content-box; }
    ::-webkit-scrollbar-track { background: transparent; }

    button, input, select, textarea { font: inherit; }
    button { user-select: none; }

    .app {
      display: grid;
      grid-template-columns: 56px 1fr 210px;
      grid-template-rows: 42px 1fr 30px;
      height: 100vh;
    }

    .side-collapsed .app {
      grid-template-columns: 56px 1fr 0;
    }

    .topbar {
      grid-column: 1 / -1;
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 5px 10px;
      background: var(--panel);
      border-bottom: 1px solid var(--line);
      backdrop-filter: blur(16px);
      z-index: 10;
    }

    .brand {
      display: flex;
      align-items: center;
      gap: 8px;
      min-width: 198px;
      font-weight: 800;
      font-size: 14px;
      letter-spacing: .2px;
    }

    .brand span {
      line-height: 1;
      background: linear-gradient(120deg, #1a2233, #3b4d75);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }

    .brand-mark {
      width: 32px;
      height: 32px;
      display: grid;
      place-items: center;
      color: #ffffff;
      font-size: 14px;
      font-weight: 900;
      letter-spacing: .5px;
      border-radius: 9px;
      background: linear-gradient(135deg, #3b82f6, #2563eb 55%, #1d4fd8);
      box-shadow: 0 6px 14px rgba(37, 99, 235, .32), inset 0 1px 0 rgba(255, 255, 255, .28);
      overflow: hidden;
    }

    a.brand-mark {
      text-decoration: none;
      -webkit-user-select: none;
      user-select: none;
      transition: transform .15s ease, box-shadow .15s ease;
    }

    a.brand-mark:hover {
      transform: translateY(-1px);
      box-shadow: 0 10px 20px rgba(37, 99, 235, .4), 0 0 0 2px rgba(37, 99, 235, .25);
    }

    .brand-mark img {
      width: 48px;
      height: 48px;
      object-fit: contain;
      display: block;
    }

    .document-title {
      min-width: 190px;
      flex: 1;
      display: none;
      flex-direction: column;
      gap: 2px;
    }

    .document-title input {
      display: none;
    }

    .save-state {
      color: var(--muted);
      font-size: 12px;
    }

    .top-actions {
      display: flex;
      align-items: center;
      gap: 5px;
      flex: 1;
      min-width: 0;
      overflow-x: auto;
      scrollbar-width: thin;
    }

    .top-actions .push-right { margin-left: auto; }

    .btn, .tool, .mini-btn {
      border: 1px solid var(--line);
      background: white;
      color: #35415c;
      border-radius: var(--radius-sm);
      cursor: pointer;
      transition: transform .12s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
    }

    .btn {
      flex: 0 0 auto;
      height: 27px;
      padding: 0 10px;
      font-weight: 650;
      font-size: 12px;
      white-space: nowrap;
      border-radius: 7px;
      box-shadow: var(--shadow-sm);
    }

    .btn:hover, .tool:hover, .mini-btn:hover {
      border-color: #b9c6dc;
      background: #fbfdff;
      box-shadow: 0 6px 16px rgba(23, 32, 55, .1);
      transform: translateY(-1px);
    }

    .btn:active, .tool:active, .mini-btn:active {
      transform: translateY(0) scale(.97);
      box-shadow: none;
    }

    .btn.primary {
      color: white;
      border-color: var(--accent-deep);
      background: linear-gradient(180deg, #3b82f6, var(--accent) 60%, var(--accent-deep));
      box-shadow: 0 8px 18px rgba(37, 99, 235, .3), inset 0 1px 0 rgba(255, 255, 255, .25);
    }

    .btn.primary:hover {
      background: linear-gradient(180deg, #4a8cf8, #2b6cf0 60%, #2257d6);
    }

    .btn.danger { color: var(--red); }

    .toolbar {
      grid-row: 2 / 4;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      padding: 8px 5px;
      margin: 10px 0 14px 6px;
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: 14px;
      box-shadow: var(--shadow-md);
      overflow-y: auto;
      overflow-x: hidden;
      z-index: 9;
    }

    .tool {
      width: 32px;
      height: 31px;
      display: grid;
      place-items: center;
      font-weight: 800;
      font-size: 12px;
      line-height: 1;
      border-radius: 9px;
      border-color: transparent;
      background: transparent;
      box-shadow: none;
    }

    .tool:hover {
      background: var(--accent-soft);
      border-color: transparent;
      box-shadow: none;
    }

    .tool.active {
      color: white;
      border-color: var(--accent-deep);
      background: linear-gradient(180deg, #3b82f6, var(--accent) 60%, var(--accent-deep));
      box-shadow: 0 6px 14px rgba(37, 99, 235, .35);
    }

    .tool[data-tool="select"].active {
      color: var(--accent-deep);
      border-color: rgba(37, 99, 235, .35);
      background: var(--accent-soft);
      box-shadow: none;
    }

    .tool-sep {
      width: 22px;
      height: 1px;
      margin: 5px 0;
      background: var(--line-strong);
    }

    .stage {
      position: relative;
      grid-column: 2;
      grid-row: 2;
      overflow: hidden;
      border-top-left-radius: 14px;
      background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28'%3E%3Cpath d='M.5 0V28' stroke='%23c3cddd' stroke-opacity='.6' stroke-dasharray='4 4'/%3E%3Cpath d='M0 .5H28' stroke='%23c3cddd' stroke-opacity='.6' stroke-dasharray='4 4'/%3E%3C/svg%3E"),
        #f7f9fc;
      background-size: 28px 28px;
      cursor: crosshair;
    }

    .stage.no-grid {
      background: #f7f9fc;
    }

    .stage.select-mode { cursor: default; }
    .stage.pan-mode { cursor: grab; }
    .stage.pan-mode:active { cursor: grabbing; }

    svg#board {
      width: 100%;
      height: 100%;
      display: block;
    }

    .page-guide {
      fill: rgba(255, 255, 255, .72);
      stroke: #b8c2d3;
      stroke-width: 2;
      stroke-dasharray: 12 10;
      vector-effect: non-scaling-stroke;
      pointer-events: none;
    }

    .page-guide-label {
      fill: #687083;
      font-size: 18px;
      font-weight: 800;
      pointer-events: none;
      user-select: none;
    }

    .anchor-dot {
      fill: #ffffff;
      stroke: #2563eb;
      stroke-width: 2;
      vector-effect: non-scaling-stroke;
      pointer-events: none;
    }

    .anchor-dot.active {
      fill: #2563eb;
      stroke: #ffffff;
      stroke-width: 3;
    }

    .align-guide {
      stroke: #7b8798;
      stroke-width: 1.2;
      stroke-dasharray: 16 12;
      opacity: .48;
      vector-effect: non-scaling-stroke;
      pointer-events: none;
    }

    .crop-mask {
      fill: rgba(15, 23, 42, .34);
      pointer-events: none;
    }

    .crop-box {
      fill: rgba(255, 255, 255, .04);
      stroke: #ffffff;
      stroke-width: 2;
      stroke-dasharray: 12 8;
      vector-effect: non-scaling-stroke;
      cursor: move;
    }

    .crop-handle {
      fill: #ffffff;
      stroke: #111827;
      stroke-width: 1.5;
      vector-effect: non-scaling-stroke;
    }

    .crop-done {
      position: absolute;
      z-index: 95;
      height: 30px;
      padding: 0 14px;
      color: #ffffff;
      font-weight: 800;
      border: 0;
      border-radius: 7px;
      background: rgba(17, 24, 39, .92);
      box-shadow: 0 10px 24px rgba(15, 23, 42, .22);
      cursor: pointer;
    }

    .selection-box {
      fill: none;
      stroke: #2563eb;
      stroke-width: 1.5;
      stroke-dasharray: 5 4;
      pointer-events: none;
    }

    .laser {
      position: absolute;
      width: 28px;
      height: 28px;
      margin: -14px 0 0 -14px;
      border: 3px solid rgba(229, 83, 83, .95);
      border-radius: 50%;
      box-shadow: 0 0 0 12px rgba(229, 83, 83, .12), 0 0 26px rgba(229, 83, 83, .5);
      pointer-events: none;
      display: none;
    }

    .side {
      grid-column: 3;
      grid-row: 2 / 4;
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: 12px 10px;
      background: #eef1f6;
      border-left: 1px solid var(--line);
      overflow-y: auto;
      z-index: 9;
      transition: transform .2s ease, opacity .2s ease;
    }

    .side-collapsed .side {
      transform: translateX(210px);
      opacity: 0;
      pointer-events: none;
    }

    .side-toggle {
      position: fixed;
      right: 210px;
      top: 50%;
      width: 22px;
      height: 58px;
      display: grid;
      place-items: center;
      color: #35415c;
      background: white;
      border: 1px solid var(--line);
      border-right: 0;
      border-radius: 10px 0 0 10px;
      box-shadow: var(--shadow-md);
      cursor: pointer;
      z-index: 40;
      transform: translateY(-50%);
      transition: right .2s ease, background .15s ease;
    }

    .side-toggle:hover { background: var(--accent-soft); }

    .side-collapsed .side-toggle {
      right: 0;
    }

    .panel {
      padding: 12px;
      background: white;
      border: 1px solid var(--line);
      border-radius: 12px;
      box-shadow: var(--shadow-sm);
    }

    .panel-layers {
      border-top: 2px solid var(--accent);
    }

    .panel-layers .mini-btn {
      color: var(--accent-deep);
      font-weight: 700;
    }

    .panel-layers .mini-btn:hover {
      border-color: rgba(37, 99, 235, .45);
      background: var(--accent-soft);
    }

    .bottom-editor-panel {
      position: fixed;
      left: 92px;
      right: 332px;
      bottom: 52px;
      height: 136px;
      max-height: 70vh;
      padding: 8px 10px;
      overflow: auto;
      z-index: 30;
      box-shadow: 0 18px 48px rgba(24, 32, 51, .18);
    }

    #editorToggleBtn,
    .bottom-editor-panel {
      display: none !important;
    }

    .inline-editor {
      position: absolute;
      z-index: 80;
      min-width: 90px;
      min-height: 32px;
      padding: 7px 9px;
      color: #182033;
      background: rgba(255, 255, 255, .98);
      border: 2px solid #2563eb;
      border-radius: 8px;
      box-shadow: 0 14px 34px rgba(24, 32, 51, .2);
      outline: none;
      resize: both;
      line-height: 1.45;
    }

    .table-edit-overlay {
      position: absolute;
      z-index: 82;
      background: rgba(255, 255, 255, .98);
      border: 2px solid #2563eb;
      border-radius: 8px;
      box-shadow: 0 18px 44px rgba(24, 32, 51, .2);
      overflow: hidden;
    }

    .table-edit-toolbar {
      display: flex;
      align-items: center;
      gap: 6px;
      padding: 6px;
      border-bottom: 1px solid var(--line);
      background: #f8fafc;
    }

    .table-edit-toolbar button {
      height: 28px;
      min-width: 36px;
      padding: 0 8px;
      font-size: 12px;
      font-weight: 800;
      border-radius: 6px;
    }

    .table-edit-toolbar input[type="color"] {
      width: 34px;
      height: 26px;
      padding: 1px;
      border: 1px solid var(--line);
      border-radius: 5px;
      background: white;
    }

    .table-edit-toolbar input[type="number"] {
      width: 54px;
      height: 26px;
      padding: 0 5px;
      border: 1px solid var(--line);
      border-radius: 5px;
    }

    .table-edit-grid {
      display: grid;
      overflow: auto;
      max-width: min(86vw, 100%);
      max-height: min(62vh, 100%);
      background: #cbd5e1;
      gap: 1px;
    }

    .table-edit-cell {
      width: 100%;
      height: 100%;
      min-width: 46px;
      min-height: 28px;
      padding: 0 8px;
      border: 0;
      outline: 0;
      background: white;
      color: #263148;
    }

    .table-edit-cell.selected {
      box-shadow: inset 0 0 0 2px #2563eb;
      background-image: linear-gradient(rgba(37, 99, 235, .08), rgba(37, 99, 235, .08));
    }

    .shape-palette {
      position: fixed;
      left: 96px;
      top: 106px;
      z-index: 85;
      width: 232px;
      padding: 12px;
      background: rgba(255, 255, 255, .98);
      border: 1px solid var(--line);
      border-radius: 12px;
      box-shadow: var(--shadow-md);
    }

    .palette-divider {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 12px 0 8px;
      font-size: 11px;
      font-weight: 800;
      color: var(--accent);
    }

    .palette-divider::before {
      content: "";
      width: 3px;
      height: 12px;
      border-radius: 2px;
      background: var(--accent);
    }

    .palette-divider::after {
      content: "";
      flex: 1;
      height: 1px;
      background: var(--line);
    }

    .org-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }

    .org-grid button {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      padding: 7px 6px 5px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #fff;
      cursor: pointer;
      transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, background .15s ease;
    }

    .org-grid button:hover {
      border-color: rgba(37, 99, 235, .5);
      background: var(--accent-soft);
      box-shadow: var(--shadow-sm);
      transform: translateY(-1px);
    }

    .org-grid svg {
      width: 100%;
      height: 40px;
    }

    .org-grid button span {
      font-size: 11px;
      font-weight: 750;
      color: #33405a;
      white-space: nowrap;
    }

    .shape-palette.hidden { display: none; }

    .mindmap-palette {
      position: fixed;
      left: 96px;
      top: 106px;
      z-index: 86;
      width: 316px;
      padding: 12px;
      background: rgba(255, 255, 255, .98);
      border: 1px solid var(--line);
      border-radius: 12px;
      box-shadow: var(--shadow-md);
    }

    .mindmap-palette.hidden { display: none; }

    .org-palette {
      width: 340px;
      z-index: 86;
    }

    .mindmap-title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      font-size: 12px;
      font-weight: 800;
      color: var(--ink);
    }

    .mindmap-title span {
      color: var(--accent);
      font-size: 11px;
      font-weight: 700;
      padding: 1px 7px;
      border-radius: 999px;
      background: var(--accent-soft);
    }

    .mindmap-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 8px;
    }

    .mindmap-grid button {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 3px;
      padding: 7px 6px 5px;
      border: 1px solid var(--line);
      border-radius: 10px;
      background: #fff;
      cursor: pointer;
      transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease, background .15s ease;
    }

    .mindmap-grid button:hover {
      border-color: rgba(37, 99, 235, .5);
      background: var(--accent-soft);
      box-shadow: var(--shadow-sm);
      transform: translateY(-1px);
    }

    .mindmap-grid svg {
      width: 100%;
      height: 40px;
    }

    .mindmap-grid button span {
      font-size: 11px;
      font-weight: 750;
      color: #33405a;
      white-space: nowrap;
    }

    .training-palette {
      position: fixed;
      right: 224px;
      top: 170px;
      z-index: 85;
      width: 236px;
      padding: 10px;
      background: rgba(255, 255, 255, .98);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: 0 18px 44px rgba(24, 32, 51, .2);
    }

    .training-palette.hidden { display: none; }

    .annotation-palette {
      position: fixed;
      left: 96px;
      top: 310px;
      z-index: 85;
      width: 232px;
      max-height: min(620px, calc(100vh - 330px));
      overflow: auto;
      padding: 12px;
      background: rgba(255, 255, 255, .98);
      border: 1px solid var(--line);
      border-radius: 12px;
      box-shadow: var(--shadow-md);
    }

    .annotation-palette.hidden { display: none; }

    .annotation-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
    }

    .annotation-grid button {
      height: 52px;
      display: grid;
      place-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fbfcfe;
      cursor: pointer;
    }

    .annotation-grid svg {
      width: 38px;
      height: 30px;
      overflow: visible;
    }

    .shape-palette h3 {
      margin: 0 0 10px;
      font-size: 15px;
    }

    .shape-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 8px;
    }

    .shape-grid button {
      height: 52px;
      display: grid;
      place-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fbfcfe;
      color: #182033;
      cursor: pointer;
      font-weight: 750;
    }

    .shape-grid button:hover {
      border-color: #9db4ff;
      background: #eef4ff;
    }

    .shape-grid svg {
      width: 36px;
      height: 28px;
      overflow: visible;
    }

    .editor-resize-handle {
      position: sticky;
      top: -8px;
      height: 10px;
      margin: -8px -10px 4px;
      background: linear-gradient(to bottom, rgba(223, 228, 236, .95), rgba(255, 255, 255, .2));
      border-radius: 8px 8px 0 0;
      cursor: ns-resize;
      z-index: 3;
    }

    .editor-resize-handle::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 3px;
      width: 52px;
      height: 3px;
      transform: translateX(-50%);
      border-radius: 999px;
      background: #b8c2d3;
    }

    .side-collapsed .bottom-editor-panel {
      right: 44px;
    }

    .bottom-editor-panel.collapsed {
      display: none;
    }

    .bottom-editor-panel .panel-title {
      position: sticky;
      top: -10px;
      z-index: 2;
      margin-bottom: 8px;
      padding: 4px 0 6px;
      background: white;
      border-bottom: 1px solid var(--line);
    }

    .panel-title {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 10px;
      font-size: 12px;
      font-weight: 800;
      letter-spacing: .3px;
    }

    .panel-title > span:first-child {
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .panel-title > span:first-child::before {
      content: "";
      width: 3px;
      height: 12px;
      border-radius: 999px;
      background: linear-gradient(180deg, #3b82f6, var(--accent-deep));
    }

    .panel-sub {
      color: var(--muted);
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0;
    }

    .field {
      display: grid;
      gap: 5px;
      margin-bottom: 8px;
    }

    .field label {
      color: var(--muted);
      font-size: 11px;
      font-weight: 700;
    }

    .field input[type="range"], .field select { width: 100%; }

    .field input[type="range"] {
      accent-color: var(--accent);
      height: 20px;
      cursor: pointer;
    }

    .field select {
      height: 28px;
      padding: 0 6px;
      border: 1px solid var(--line-strong);
      border-radius: var(--radius-sm);
      background: white;
      color: var(--ink);
      cursor: pointer;
    }

    .field select:hover { border-color: #b9c6dc; }

    .num-pair {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 6px;
    }

    .field input[type="number"],
    .num-attach input[type="number"] {
      width: 100%;
      height: 28px;
      padding: 0 6px;
      border: 1px solid var(--line-strong);
      border-radius: var(--radius-sm);
      background: white;
      color: var(--ink);
      font: inherit;
      font-weight: 700;
      text-align: center;
    }

    .field input[type="number"]:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
    }

    .num-attach {
      display: flex;
      align-items: center;
      gap: 5px;
      flex: 1;
      min-width: 0;
    }

    .num-attach label {
      font-size: 11px;
      font-weight: 750;
      color: var(--muted);
      white-space: nowrap;
    }

    .num-attach input[type="number"] {
      flex: 1;
      min-width: 0;
      height: 26px;
    }

    .field input[type="color"] {
      width: 100%;
      height: 28px;
      padding: 2px;
      border: 1px solid var(--line-strong);
      border-radius: var(--radius-sm);
      background: white;
      cursor: pointer;
    }

    .field input[type="color"]:hover { border-color: #b9c6dc; }

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

    .row > * { flex: 1; }

    .mini-btn {
      min-width: 0;
      height: 28px;
      padding: 0 6px;
      font-size: 11px;
      font-weight: 700;
      white-space: nowrap;
      box-shadow: var(--shadow-sm);
    }

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

    .template {
      min-height: 38px;
      padding: 6px;
      text-align: left;
      border: 1px solid var(--line);
      background: #fbfcfe;
      border-radius: 8px;
      cursor: pointer;
    }

    .template strong {
      display: block;
      margin-bottom: 2px;
      font-size: 11px;
    }

    .template span {
      color: var(--muted);
      font-size: 10px;
      line-height: 1.25;
    }

    .editor-body {
      display: flex;
      flex-wrap: wrap;
      align-items: flex-start;
      gap: 6px;
    }

    .editor-empty {
      color: var(--muted);
      font-size: 12px;
      line-height: 1.55;
    }

    .editor-input, .editor-textarea, .table-cell-input {
      width: 100%;
      border: 1px solid var(--line);
      border-radius: 7px;
      outline: 0;
      color: var(--ink);
      background: #fff;
    }

    .editor-input {
      height: 28px;
      padding: 0 8px;
    }

    .editor-textarea {
      min-height: 40px;
      max-height: 62px;
      padding: 5px 8px;
      resize: vertical;
      line-height: 1.5;
    }

    .bottom-editor-panel .field {
      min-width: 210px;
      flex: 1 1 240px;
      margin-bottom: 0;
      gap: 4px;
    }

    .bottom-editor-panel .field label {
      font-size: 11px;
    }

    .editor-input:focus, .editor-textarea:focus, .table-cell-input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
    }

    .table-editor-wrap {
      max-height: calc(100% - 50px);
      flex: 1 1 100%;
      overflow: auto;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
    }

    .table-editor {
      display: grid;
      min-width: max-content;
    }

    .table-cell-input {
      width: 112px;
      height: 28px;
      padding: 0 8px;
      border-radius: 0;
      border-width: 0 1px 1px 0;
    }

    .context-menu {
      position: fixed;
      min-width: 150px;
      padding: 5px;
      display: none;
      background: white;
      border: 1px solid var(--line);
      border-radius: 10px;
      box-shadow: var(--shadow-md);
      z-index: 99;
      font-size: 12px;
    }

    .context-menu button {
      width: 100%;
      height: 28px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 0 7px;
      color: #263148;
      background: transparent;
      border: 0;
      border-radius: 5px;
      cursor: pointer;
      text-align: left;
    }

    .context-menu button:hover {
      background: #f2f5fa;
    }

    .context-menu button[disabled] {
      color: #a3adbd;
      cursor: default;
    }

    .context-menu button[disabled]:hover {
      background: transparent;
    }

    .context-menu .divider {
      height: 1px;
      margin: 3px 0;
      background: var(--line);
    }

    .context-field {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      min-height: 28px;
      padding: 3px 7px;
      color: #263148;
      font-size: 12px;
    }

    .context-field input[type="color"] {
      width: 36px;
      height: 22px;
      padding: 1px;
      border: 1px solid var(--line);
      border-radius: 5px;
      background: #fff;
      cursor: pointer;
    }

    .context-field input[type="number"] {
      width: 44px;
      height: 22px;
      padding: 0 6px;
      border: 1px solid var(--line);
      border-radius: 5px;
      background: #fff;
    }

    .fullscreen-exit {
      position: fixed;
      right: 10px;
      bottom: 10px;
      display: none;
      z-index: 120;
      height: 28px;
      padding: 0 10px;
      color: white;
      font-size: 12px;
      font-weight: 800;
      border: 0;
      border-radius: 6px;
      background: rgba(24, 32, 51, .88);
      box-shadow: 0 12px 30px rgba(24, 32, 51, .24);
      cursor: pointer;
    }

    html.is-fullscreen,
    body.is-fullscreen {
      overflow: hidden;
    }

    html.is-fullscreen .fullscreen-exit,
    .is-fullscreen .fullscreen-exit {
      display: block;
    }

    html.is-fullscreen .app,
    .is-fullscreen .app {
      grid-template-columns: 56px 1fr;
      grid-template-rows: 1fr;
    }

    html.is-fullscreen .topbar,
    html.is-fullscreen .side,
    html.is-fullscreen .statusbar,
    html.is-fullscreen .side-toggle,
    :fullscreen .topbar,
    :fullscreen .side,
    :fullscreen .statusbar,
    :fullscreen .side-toggle,
    .is-fullscreen .topbar,
    .is-fullscreen .side,
    .is-fullscreen .statusbar,
    .is-fullscreen .side-toggle {
      display: none;
    }

    html.is-fullscreen .toolbar,
    .is-fullscreen .toolbar {
      grid-column: 1;
      grid-row: 1;
    }

    html.is-fullscreen .stage,
    .is-fullscreen .stage {
      grid-column: 2;
      grid-row: 1;
    }

    .table-size-input {
      height: 28px;
      min-height: 0;
      padding: 0 6px;
    }

    .statusbar {
      grid-column: 2;
      grid-row: 3;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      padding: 0 12px;
      color: var(--muted);
      font-size: 11px;
      background: rgba(255, 255, 255, .9);
      border-top: 1px solid var(--line);
      z-index: 8;
    }

    .statusbar .kbd {
      margin-right: 2px;
    }

    .kbd {
      padding: 1px 5px;
      color: #49556d;
      border: 1px solid #cbd4e3;
      border-bottom-width: 2px;
      border-radius: 5px;
      background: white;
      font-weight: 800;
    }

    .hidden-input { display: none; }

    .presenting .topbar, .presenting .side, .presenting .statusbar, .presenting .side-toggle {
      display: none;
    }

    .presenting .bottom-editor-panel, .presenting .context-menu {
      display: none;
    }

    .presenting .app {
      grid-template-columns: 56px 1fr;
      grid-template-rows: 1fr;
    }

    .presenting .toolbar {
      grid-column: 1;
      grid-row: 1;
      display: flex;
    }

    .presenting .stage {
      grid-column: 2;
      grid-row: 1;
    }

    .presenter-exit {
      position: fixed;
      top: 12px;
      left: 50%;
      display: none;
      transform: translateX(-50%);
      z-index: 130;
      height: 38px;
      padding: 0 16px;
      color: white;
      font-weight: 800;
      border: 0;
      border-radius: 999px;
      background: rgba(24, 32, 51, .9);
      box-shadow: 0 12px 30px rgba(24, 32, 51, .24);
      cursor: pointer;
    }

    .presenting .presenter-exit {
      display: block;
    }

    @media (max-width: 1080px) {
      .app {
        grid-template-columns: 56px 1fr;
        grid-template-rows: auto 1fr 30px auto;
      }
      .topbar { grid-column: 1 / -1; flex-wrap: wrap; height: auto; padding: 6px 10px; }
      .toolbar { grid-row: 2 / 4; }
      .stage { grid-column: 2; grid-row: 2; min-height: 620px; }
      .statusbar { grid-column: 2; grid-row: 3; }
      .side { grid-column: 1 / -1; grid-row: 4; display: grid; grid-template-columns: repeat(3, 1fr); }
      .bottom-editor-panel {
        left: 70px;
        right: 14px;
        bottom: 52px;
      }
      .side-toggle { display: none; }
    }

    @media (max-width: 760px) {
      body { overflow: auto; }
      .app {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(640px, 1fr) auto auto;
        min-height: 100vh;
        height: auto;
      }
      .toolbar {
        grid-column: 1;
        grid-row: 2;
        flex-direction: row;
        justify-content: flex-start;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        overflow-x: auto;
      }
      .tool-sep { width: 1px; height: 30px; }
      .stage { grid-column: 1; grid-row: 3; }
      .statusbar { grid-column: 1; grid-row: 4; flex-wrap: wrap; height: auto; min-height: 40px; }
      .side { grid-row: 5; grid-template-columns: 1fr; }
      .bottom-editor-panel {
        left: 12px;
        right: 12px;
        bottom: 12px;
        max-height: 45vh;
      }
      .brand { min-width: auto; }
      .top-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        width: 100%;
        padding-bottom: 2px;
      }
      .btn {
        height: 26px;
        padding: 0 7px;
        font-size: 12px;
      }
      .brand-mark {
        width: 32px;
        height: 32px;
        font-size: 15px;
      }
      .brand span { font-size: 14px; }
    }
