  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; height: 100%; }
  body {
    font-family: Arial, Helvetica, sans-serif;
    background: #171717;
    color: #e8e8e8;
    overflow: hidden;
  }
  .app {
    display: grid;
    grid-template-rows: 34px 154px 28px 1fr 0px 30px;
    width: 100vw;
    height: 100vh;
    min-width: 1180px;
    min-height: 720px;
    background: #202020;
  }
  .icon { width: 15px; height: 15px; display: block; margin: 0 auto; }
  button, .qbtn, .tool, .side-tool, .sbtn, .nav-btn, .mini-btn { cursor: pointer; user-select: none; }

  /* Password gate */
  .lock-screen {
    position: fixed; inset: 0; z-index: 9999; background: #101010;
    display: flex; align-items: center; justify-content: center;
  }
  .lock-screen.hidden { display: none; }
  .lock-card {
    width: 330px; background: #1d1d1d; border: 1px solid #3a3a3a; border-radius: 8px;
    padding: 24px 24px 18px; text-align: center; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  }
  .lock-card .lock-ico { width: 26px; height: 26px; color: #7fc793; margin-bottom: 8px; }
  .lock-title { font-size: 16px; font-weight: bold; color: #ffffff; margin-bottom: 6px; }
  .lock-msg { font-size: 12px; color: #a9a9a9; line-height: 1.45; margin-bottom: 14px; }
  .lock-card input {
    width: 100%; height: 32px; background: #121212; border: 1px solid #4a4a4a; border-radius: 4px;
    color: #ffffff; font-size: 13px; padding: 4px 9px; margin-bottom: 9px; outline: none;
  }
  .lock-card input:focus { border-color: #57a773; }
  .lock-btn {
    width: 100%; height: 34px; background: #244434; border: 1px solid #57a773; border-radius: 4px;
    color: #ffffff; font-size: 13px; cursor: pointer;
  }
  .lock-btn:hover { background: #2c4636; }
  .lock-err { color: #ff9c9c; font-size: 12px; min-height: 16px; margin-top: 9px; }

  /* Object Snap dialog and the F2 text window (V0.4.0) */
  /* Layer bands (V0.83.13): canvas and dock UI
     below 100; floated panels 4500; auto-hide
     overlay panels 4600; transient menus and
     popups up to 6000; MODALS 7000 (stacked
     dialog overrides 7085 and 7086, Help 7100);
     the drag shield 9990 and the sign-in gate
     9999 stay topmost. Modals sit above every
     panel state on purpose: a dialog opened
     from a panel must never be covered by it,
     in docked, auto-hide overlay, or floated
     state alike. */
  .modal-backdrop {
    position: fixed; inset: 0; z-index: 7000; background: rgba(0, 0, 0, 0.55);
    display: flex; align-items: center; justify-content: center;
  }
  .modal-card {
    width: 340px; background: #1d1d1d; border: 1px solid #3a3a3a; border-radius: 8px;
    padding: 18px 20px 14px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55); color: #dddddd;
  }
  .modal-title { font-size: 14px; font-weight: bold; color: #ffffff; margin-bottom: 6px; }
  .att-edit-head, .att-edit-row { display: grid; grid-template-columns: 130px 1fr 1.4fr; gap: 8px; align-items: center; }
  .att-edit-head { font-weight: 600; color: #ffffff; margin: 10px 0 4px; }
  .att-edit-row { margin: 4px 0; }
  .att-edit-rows { max-height: 46vh; overflow-y: auto; padding-right: 4px; }
  .attdef-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 14px; margin: 2px 0 6px; }
  .osnap-master { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 0 10px; border-bottom: 1px solid #333333; margin-bottom: 8px; cursor: pointer; }
  .osnap-row { display: flex; align-items: center; gap: 9px; font-size: 13px; padding: 3px 2px; cursor: pointer; }
  .osnap-row:hover { background: #262626; }
  .osnap-row canvas { flex: none; }
  .modal-btns { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
  .mbtn {
    height: 30px; padding: 0 14px; background: #2b2b2b; border: 1px solid #4a4a4a; border-radius: 4px;
    color: #ffffff; font-size: 12.5px; cursor: pointer;
  }
  .mbtn:hover { background: #3a3a3a; }
  .mbtn.primary { background: #244434; border-color: #57a773; }
  .mbtn.primary:hover { background: #2c4636; }
  .dxf-prog-track { height: 10px; background: #101010; border: 1px solid #4a4a4a; border-radius: 5px; overflow: hidden; margin: 10px 0 6px; }
  .dxf-prog-fill { height: 100%; width: 0%; background: #57a773; transition: width 120ms linear; }
  .flex-spacer { flex: 1; }
  .tw-body {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 14px; font-family: Consolas, "Courier New", monospace;
    font-size: 12.5px; line-height: 1.5; color: #cccccc;
  }
  .tw-body .err { color: #ff9c9c; }
  .tw-body .note { color: #6db3f2; }
  .tw-body .cmd { color: #7fc793; }
  .snap-menu {
    position: fixed; z-index: 960; width: 218px; background: #1d1d1d; border: 1px solid #3a3a3a;
    border-radius: 6px; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55); padding: 5px; color: #dddddd;
  }
  .snap-menu-title { font-size: 10.5px; color: #8a8a8a; letter-spacing: 0.6px; padding: 3px 7px 5px; }
  .snap-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 3.5px 7px; border-radius: 3px; cursor: pointer; }
  .snap-item:hover { background: #20392b; color: #ffffff; }
  .snap-item.armed { background: #244434; color: #ffffff; }
  .snap-item canvas { flex: none; }
  .snap-item .snap-key { margin-left: auto; color: #7fc793; font-size: 11px; border: 1px solid #3a3a3a; border-radius: 3px; padding: 0 5px; }
  .ctx-sep { height: 1px; background: #3a3a3a; margin: 4px 2px; }
  #ctxMenu, #ctxSubMenu { width: 252px; }
  #ctxSubMenu { z-index: 970; }
  #ctxMenu .snap-key, #ctxSubMenu .snap-key { margin-left: auto; }
  .snap-item.ctx-disabled { opacity: 0.45; cursor: default; }
  .snap-item.ctx-hl { background: #333333; }
  body[data-theme="light"] .snap-item.ctx-hl { background: #dcdcdc; }
  .snap-item .ctx-arrow { margin-left: auto; width: 0; height: 0; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 5px solid currentColor; opacity: 0.75; flex: none; }
  .rc-row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
  .rc-group { border: 1px solid #3a3a3a; border-radius: 6px; padding: 8px 10px; margin-top: 10px; }
  body[data-theme="light"] .rc-group { border-color: #c4c4c4; }
  .rc-group-title { font-weight: 600; }
  .rc-group-sub { opacity: 0.75; font-size: 12px; margin: 2px 0 4px; }
  .count-row { display: flex; justify-content: space-between; padding: 2px; font-size: 13px; }
  .count-total { border-top: 1px solid #3a3a3a; margin-top: 4px; padding-top: 5px; font-weight: 600; }
  body[data-theme="light"] .count-total { border-top-color: #c4c4c4; }
  .count-note { opacity: 0.75; font-size: 12px; margin-top: 6px; }

  /* Quick access and title bar */
  .titlebar {
    display: grid;
    grid-template-columns: 420px 1fr 360px;
    align-items: center;
    background: #111111;
    border-bottom: 1px solid #000000;
    padding: 0 10px;
    gap: 12px;
  }
  .brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
  .logo {
    width: 24px; height: 24px; border-radius: 5px;
    background: #17452e; border: 1px solid #3f8f63; flex: none;
  }
  .logo svg { width: 16px; height: 16px; display: block; margin: 4px auto 0; }
  .brand-name { font-size: 13px; font-weight: bold; letter-spacing: 0.2px; white-space: nowrap; }
  .quick-actions { display: flex; align-items: center; gap: 5px; margin-left: 8px; }
  .qbtn {
    min-width: 27px; height: 22px; padding: 2px 6px;
    border: 1px solid #3a3a3a; background: #242424; color: #dddddd;
    font-size: 11px; text-align: center; border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
  }
  .qbtn:hover { background: #2f2f2f; border-color: #57a773; }
  .qbtn .icon { width: 14px; height: 14px; }
  /* Recent files chevron (V0.32.0, Chris's ask):
     half the width of the other quick buttons and
     right up against Open, so it reads as part of
     the Open button. Height unchanged. */
  #recentBtn { min-width: 0; width: 16px; padding: 2px 0; margin-left: -5px; }
  .drawing-title { text-align: center; color: #cfcfcf; font-size: 13px; white-space: nowrap; }
  .title-right { display: flex; justify-content: flex-end; align-items: center; gap: 7px; color: #bbbbbb; font-size: 12px; }
  .search-box {
    width: 150px; height: 22px; border: 1px solid #3d3d3d; background: #262626;
    color: #999999; padding: 3px 7px; font-size: 11px; border-radius: 3px;
  }

  /* Ribbon */
  .ribbon { background: #2b2b2b; border-bottom: 1px solid #111111; display: grid; grid-template-rows: 28px 126px; }
  .ribbon-tabs { display: flex; align-items: end; gap: 2px; padding: 0 8px; border-bottom: 1px solid #1c1c1c; }
  .rtab { padding: 6px 12px 5px; font-size: 12px; color: #cfcfcf; border-radius: 4px 4px 0 0; cursor: pointer; }
  .rtab.active { background: #3a3a3a; color: #ffffff; }
  .ribbon-body { display: flex; gap: 10px; padding: 6px 10px 4px; overflow: hidden; }
  .ribbon { position: relative; z-index: 30; }
  /* Ribbon states retarget the ribbon track of the .app grid.
     The ribbon stays a grid item in every state (visibility and
     overflow do the hiding), so the other rows never shift. */
  body[data-ribbonmode="titles"] .app { grid-template-rows: 34px 58px 28px 1fr 0px 30px; }
  body[data-ribbonmode="tabs"] .app { grid-template-rows: 34px 28px 28px 1fr 0px 30px; }
  body[data-ribbonmode="titles"] .ribbon { grid-template-rows: 28px 30px; }
  body[data-ribbonmode="tabs"] .ribbon { grid-template-rows: 28px 0px; overflow: visible; }
  body[data-ribbonmode="titles"] .ribbon-body { display: none; }
  body[data-ribbonmode="tabs"] .ribbon-body { display: none; }
  body[data-ribbonmode="tabs"] .ribbon.pop .ribbon-body {
    display: flex; position: absolute; top: 28px; left: 0; right: 0; height: 126px;
    box-sizing: border-box; background: #2b2b2b; border-bottom: 1px solid #111111;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.45); z-index: 40;
  }
  .ribbon-strip { display: none; }
  .ribbon-strip svg { width: 10px; height: 10px; display: block; }
  /* Panel Titles state (V0.55.0): a bar of titled
     buttons stands in for the body, one per panel,
     and the panel itself pops out below the ribbon
     when its title is clicked, the standard way. */
  .ribbon-titles { display: none; }
  body[data-ribbonmode="titles"] .ribbon-titles {
    display: flex; align-items: center; gap: 2px; padding: 0 8px; background: inherit;
  }
  .rtitle {
    display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: #cfcfcf;
    background: #333333; border: 1px solid #4a4a4a; border-radius: 3px;
    padding: 4px 10px; cursor: pointer; user-select: none;
  }
  .rtitle:hover { border-color: #57a773; color: #ffffff; }
  .rtitle.active { background: #244434; border-color: #57a773; color: #ffffff; }
  .rtitle .rm-ico { width: 11px; height: 11px; }
  .ribbon-pop {
    display: none; position: absolute; top: 100%; z-index: 45;
    background: #2b2b2b; border: 1px solid #111111; border-top: none;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.45); padding: 6px 10px 4px;
  }
  .ribbon-pop.open { display: block; }
  .ribbon-pop .panel { border-right: none; padding-right: 0; }
  /* The MTEXT editor's contextual tab (V0.56.0):
     while the editor is open, its body replaces the
     ribbon's own in Full mode, its panels pop from
     the Titles bar in Panel Titles mode, and its
     body pops with the rest in Tabs mode. */
  #mtCtxBody { display: none; }
  body.mt-editing #ribbonBody { display: none; }
  body.mt-editing #mtCtxBody { display: flex; }
  body[data-ribbonmode="titles"] #mtCtxBody { display: none; }
  body[data-ribbonmode="tabs"] #mtCtxBody { display: none; }
  body.mt-editing[data-ribbonmode="tabs"] .ribbon.pop #mtCtxBody {
    display: flex; position: absolute; top: 28px; left: 0; right: 0; height: 126px;
    box-sizing: border-box; background: #2b2b2b; border-bottom: 1px solid #111111;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.45); z-index: 40;
  }
  .ribbon-mode {
    margin-left: auto; align-self: center; display: flex; align-items: center; gap: 5px;
    font-size: 11px; color: #cfcfcf; background: #333333; border: 1px solid #4a4a4a;
    border-radius: 3px; padding: 3px 8px; cursor: pointer; user-select: none;
  }
  .ribbon-mode:hover { border-color: #57a773; color: #ffffff; }
  .ribbon-mode .rm-ico { width: 12px; height: 12px; }
  #ribbonHandle {
    display: none; margin-left: auto; align-items: center; gap: 5px;
    font-size: 11px; color: #cfcfcf; background: #262626; border: 1px solid #3d3d3d;
    border-radius: 3px; padding: 2px 8px; cursor: pointer; user-select: none;
  }
  #ribbonHandle:hover { border-color: #57a773; color: #ffffff; }
  #ribbonHandle .rm-ico { width: 12px; height: 12px; }
  .panel { border-right: 1px solid #454545; padding-right: 10px; display: flex; flex-direction: column; }
  .panel:last-child { border-right: none; }
  .panel-title { text-align: center; font-size: 10px; color: #a9a9a9; margin-top: 4px; }
  .tool-grid { display: grid; grid-template-columns: repeat(4, 42px); gap: 5px 6px; }
  .tool-grid.two { grid-template-columns: repeat(2, 58px); }
  .tool-grid.three { grid-template-columns: repeat(3, 46px); }
  .tool-grid.five { grid-template-columns: repeat(5, 42px); }
  .tool {
    height: 30px; border: 1px solid #4a4a4a; background: #333333; border-radius: 3px;
    color: #eeeeee; text-align: center; padding-top: 3px;
  }
  .tool:hover { border-color: #57a773; background: #2c4636; }
  .tool .glyph { display: block; height: 15px; color: #ffffff; }
  .tool .label { display: block; font-size: 8.5px; line-height: 9px; color: #c9c9c9; white-space: nowrap; }
  .tool.active { border-color: #57a773; background: #244434; }
  .tool.disabled { opacity: 0.55; }
  .layer-row { display: grid; grid-template-columns: 1fr 24px 24px 24px; gap: 5px; align-items: center; margin-bottom: 6px; }
  .layer-select {
    height: 24px; background: #1f1f1f; border: 1px solid #555555; color: #ffffff;
    font-size: 11px; padding: 3px 4px; width: 100%;
  }
  .mini-btn {
    height: 24px; border: 1px solid #4c4c4c; background: #343434; color: #dddddd;
    font-size: 10px; text-align: center; border-radius: 3px;
    display: flex; align-items: center; justify-content: center;
  }
  .mini-btn.off { opacity: 0.45; }
  .mini-btn .icon { width: 13px; height: 13px; }
  .prop-row { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: #cccccc; margin: 4px 0; white-space: nowrap; }
  .prop-row .clickable { cursor: pointer; }
  .prop-row .clickable:hover { color: #ffffff; text-decoration: underline; }
  .swatch { display: inline-block; width: 12px; height: 12px; border: 1px solid #777777; vertical-align: -2px; margin-right: 4px; background: #ffffff; }

  /* File tabs */
  .file-tabs { display: flex; align-items: center; gap: 3px; background: #1a1a1a; padding: 0 8px; border-bottom: 1px solid #000000; }
  .ftab { padding: 5px 12px; font-size: 11.5px; color: #bbbbbb; background: #262626; border: 1px solid #3a3a3a; border-bottom: none; border-radius: 4px 4px 0 0; }
  .ftab.active { background: #101010; color: #ffffff; }
  .ftab.plus { padding: 3px 9px; cursor: pointer; }
  .ftab.dtab { cursor: pointer; display: flex; align-items: center; gap: 8px; }
  .ftab .ftab-x { opacity: .55; font-size: 13px; line-height: 1; padding: 0 2px; border-radius: 3px; }
  .ftab .ftab-x:hover { opacity: 1; background: rgba(255, 255, 255, .14); }
  .tab-plus .icon { width: 11px; height: 11px; display: inline-block; vertical-align: -1px; }

  /* Workspace */
  .workspace { display: grid; grid-template-columns: auto 1fr auto auto; grid-template-rows: minmax(0, 1fr); min-height: 0; }

  .side-tool {
    width: 32px; height: 32px; border: 1px solid #484848; background: #303030; border-radius: 4px;
    color: #eeeeee; display: flex; align-items: center; justify-content: center;
  }
  .side-tool:hover { border-color: #57a773; }
  .side-tool.active { border-color: #57a773; background: #244434; }
  .side-tool .icon { width: 17px; height: 17px; }
  .side-spacer { flex: 1; }
  .canvas-wrap { position: relative; background: #0d0d0d; overflow: hidden; min-width: 0; cursor: crosshair; }
  .canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  #glw { z-index: 0; }
  #gl { z-index: 1; }
  #ov { z-index: 2; cursor: none; }
  .dyn-input {
    position: absolute; z-index: 5; pointer-events: none; display: none;
    background: rgba(20,20,20,0.92); border: 1px solid #57a773; border-radius: 3px;
    padding: 4px 7px; font-size: 11px; color: #ffffff; white-space: nowrap;
  }
  .dyn-input .dyn-title { color: #9fd6b4; font-size: 10px; margin-bottom: 2px; }
  .ucs { position: absolute; left: 14px; bottom: 40px; z-index: 3; width: 44px; height: 44px; pointer-events: none; }
  .ucs .axis-y { position: absolute; left: 8px; bottom: 8px; width: 2px; height: 30px; background: #37b24d; }
  .ucs .axis-x { position: absolute; left: 8px; bottom: 8px; width: 30px; height: 2px; background: #e5484d; }
  .ucs .ylab { position: absolute; left: 4px; top: -2px; color: #37b24d; font-size: 11px; }
  .ucs .xlab { position: absolute; right: -2px; bottom: 2px; color: #e5484d; font-size: 11px; }
  .nav-controls { position: absolute; right: 10px; top: 10px; z-index: 4; display: flex; flex-direction: column; gap: 6px; width: 74px; }
  .viewcube {
    width: 58px; height: 58px; margin: 0 auto; border: 1px solid #666666;
    background: rgba(45,45,45,0.88); color: #ffffff; text-align: center;
    padding-top: 9px; font-size: 10px; line-height: 13px;
  }
  .nav-btn {
    height: 25px; border: 1px solid #5a5a5a; background: rgba(45,45,45,0.9); color: #eeeeee;
    font-size: 11px; text-align: center; padding-top: 4px; border-radius: 3px;
  }
  .nav-btn:hover { border-color: #57a773; }
  .nav-btn .icon { width: 13px; height: 13px; display: inline-block; vertical-align: -2px; margin: 0 4px 0 0; }
  .ps-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 0; }
.layout-tabs {
    position: absolute; left: 0; bottom: 0; z-index: 4; display: flex; align-items: flex-start; gap: 2px;
    padding: 0 7px; height: 28px; background: rgba(27,27,27,0.96);
    border-top: 1px solid #383838; border-right: 1px solid #383838;
  }
  /* The drawing area's tabs speak the shared tab
     language (V0.71.0): they hang from the strip's
     top edge, joined to the drawing area above;
     the active one carries the drawing area's own
     surface color and full-bright text, the rest
     sit recessed with muted text. The strip itself
     stays dark in both themes, so one rule set
     serves both. */
  .ltab { padding: 5px 11px 6px; font-size: 11px; color: #9a9a9a; background: #2c2c2c; border: 1px solid #3d3d3d; border-top: none; border-radius: 0 0 5px 5px; cursor: pointer; }
  .ltab:hover { background: #343434; color: #e6e6e6; }
  .ltab.active { background: #0d0d0d; color: #ffffff; border-color: #3d3d3d; padding-bottom: 8px; }

  /* Properties and layers palette */
  .palette { background: #262626; border-left: 1px solid #101010; display: flex; flex-direction: column; min-height: 0; }
  .palette-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 10px; height: 30px; background: #1d1d1d; border-bottom: 1px solid #3a3a3a;
    font-size: 12px; font-weight: bold;
  }
  .pal-close .icon { width: 11px; height: 11px; }
  .palette-body { padding: 8px 10px; overflow-y: auto; min-height: 0; }
  .section-title { font-size: 11px; font-weight: bold; color: #9fd6b4; margin: 8px 0 5px; text-transform: uppercase; letter-spacing: 0.4px; }
  .kv { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: #bbbbbb; margin: 3px 0; }
  .kv .value { background: #1c1c1c; border: 1px solid #3d3d3d; color: #ffffff; padding: 2px 6px; min-width: 108px; text-align: right; }
  .kv .value.green { color: #8fe3aa; }
  .layers-box { border-top: 1px solid #3a3a3a; padding: 6px 10px 10px; overflow-y: auto; min-height: 0; }
  .layer-line { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #dddddd; padding: 3px 4px; border-radius: 3px; cursor: pointer; }
  .layer-line:hover { background: #2f2f2f; }
  .layer-line.current { background: #20392b; }
  .layer-color { width: 12px; height: 12px; border: 1px solid #777777; flex: none; }
  .layer-line .lname { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .layer-state { cursor: pointer; padding: 1px 3px; border-radius: 2px; }
  .layer-state:hover { background: #3d3d3d; }
  .layer-state .icon { width: 12px; height: 12px; }
  .layer-state.off { opacity: 0.35; }
  .layers-add { margin-top: 6px; font-size: 11px; color: #9fd6b4; cursor: pointer; }
  .layers-add:hover { text-decoration: underline; }

  /* Command line */
  .command-area { display: grid; grid-template-columns: 1fr; background: #141414; border-top: 1px solid #000000; min-height: 0; height: 100%; overflow: hidden; }
  /* Text selection (V0.34.0, Chris's rule): the
     app does not select text anywhere except the
     text window, the command line, the drawing
     name title, and actual editing fields, so
     dragging around the interface never paints
     stray highlights. */
  body { user-select: none; -webkit-user-select: none; }
  #drawingTitle, .tw-body, .command-area, input, textarea, select, [contenteditable="true"] { user-select: text; -webkit-user-select: text; }
  /* Command autocomplete (V0.33.0, Chris's spec):
     the suggestion list floats above the command
     line while typing, replacing the old side
     panel at the end of the command area. */
  .command-left { position: relative; }
  .cmd-suggest-pop { position: fixed; min-width: 300px; max-width: 440px; max-height: 232px; overflow-y: auto; background: #1b1b1b; border: 1px solid #3a3a3a; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,0.5); z-index: 4000; padding: 3px; }
  .cmd-suggest-pop .suggest-item { display: flex; justify-content: space-between; gap: 18px; font-size: 12px; color: #cfcfcf; padding: 4px 7px; border-radius: 2px; cursor: pointer; }
  .cmd-suggest-pop .suggest-item.active { background: #20392b; color: #ffffff; }
  /* The command area's content column: it
     fills the body wrapper as a flex column,
     so the history takes the leftover height
     and scrolls inside the panel. V0.35.7:
     this rule once selected the content as a
     direct child of the panel; the V0.35.0
     body wrapper moved it one level down,
     the rule stopped matching, and the
     history grew to its full content height,
     painting down off the page on every
     write. */
  .command-area .command-left { display: flex; flex-direction: column; flex: 1 1 auto; height: 100%; min-height: 0; min-width: 0; }
  /* The command line as a panel (V0.34.0): header
     row plus the content row, full width of any
     horizontal dock it lands in. */
  .command-area { grid-template-rows: auto minmax(0, 1fr); }
  .dock-h > .command-area { flex: 1 1 100%; min-width: 0; }
  .statusbar { grid-row: 6; }
  .command-history { flex: 1 1 auto; min-height: 0; padding: 6px 10px 2px; overflow-y: auto; font-family: Consolas, "Courier New", monospace; font-size: 12px; line-height: 17px; color: #d5d5d5; }
  .command-history .dim { color: #8a8a8a; }
  .command-history .cmd { color: #ffffff; font-weight: bold; }
  .command-history .err { color: #ff9c9c; }
  .command-history .note { color: #6db3f2; }
  .command-input-row { flex: none; display: flex; align-items: center; gap: 7px; padding: 4px 10px 8px; }
  .command-input-row .prompt { font-family: Consolas, "Courier New", monospace; font-size: 12px; color: #9fd6b4; white-space: nowrap; }
  #cmdInput {
    flex: 1; background: #1e1e1e; border: 1px solid #3d7a55; color: #ffffff;
    font-family: Consolas, "Courier New", monospace; font-size: 12.5px; padding: 5px 8px; outline: none;
  }
  .suggest { border-left: 1px solid #2c2c2c; padding: 6px 9px; overflow-y: auto; min-height: 0; }
  .suggest-title { font-size: 10px; color: #8a8a8a; letter-spacing: 0.6px; margin-bottom: 4px; }
  .suggest-item { display: flex; justify-content: space-between; font-size: 11.5px; color: #cfcfcf; padding: 2.5px 4px; border-radius: 2px; cursor: pointer; }
  .suggest-item:hover, .suggest-item.active { background: #20392b; color: #ffffff; }

  /* Status bar */
  .statusbar {
    display: grid; grid-template-columns: 250px 1fr 300px; align-items: center; gap: 10px;
    background: #1b1b1b; border-top: 1px solid #000000; padding: 0 9px; font-size: 11px;
  }
  .units-cols { display: flex; gap: 10px; }
  .units-group { border: 1px solid #3a4a5a; border-radius: 4px; padding: 6px 10px 10px; margin: 0 0 10px; flex: 1; min-width: 0; }
  .units-group legend { padding: 0 5px; color: #cfe3f5; font-size: 12px; }
  .units-field { margin: 6px 0; }
  .units-field label { display: block; margin-bottom: 3px; }
  .units-field select { width: 100%; }
  .units-check { display: block; margin: 8px 0 2px; }
  .units-sample { font-family: Consolas, "Courier New", monospace; white-space: pre-line; color: #eeeeee; min-height: 34px; }
  #textEditor { position: absolute; z-index: 25; background: rgba(10, 10, 10, 0.88); border: 1px dashed #8a8a8a; color: #ffffff; padding: 0 2px; outline: none; }
  .style-cols { display: flex; gap: 14px; }
  .style-left { width: 180px; flex: none; }
  .style-left select { width: 100%; }
  .style-right { flex: 1; min-width: 0; }
  .style-list-btns, .style-font-btns { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; }
  .style-checks { display: flex; gap: 14px; margin: 6px 0; flex-wrap: wrap; }
  .style-preview { border: 1px solid #3a4a5a; border-radius: 4px; padding: 8px 10px; min-height: 34px; color: #eeeeee; overflow: hidden; white-space: nowrap; }
  #styleDialog input[type="text"] { width: 100%; box-sizing: border-box; background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 4px 6px; }
  #mtextEditor { position: absolute; z-index: 26; background: #141a21; border: 1px solid #3a4a5a; border-radius: 5px; padding: 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6); }
  .mt-tools { display: flex; gap: 5px; align-items: center; margin-bottom: 6px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
  .mt-tools input[type="text"] { background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 4px 6px; }
  #mtStyle { width: 96px; }
  #mtFont { width: 118px; }
  .mt-tools select { background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 4px 4px; }
  #mtHeight { width: 58px; }
  .mtb { background: #1d2835; color: #d7e3ee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 4px 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
  .mtb svg { width: 16px; height: 16px; display: block; }
  #mtColorWrap { position: relative; }
  #mtColor { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
  #mtColorBar { position: absolute; left: 5px; right: 5px; bottom: 2.5px; height: 3px; background: #ffffff; border-radius: 1px; }
  #mtResize { position: absolute; right: 2px; bottom: 2px; width: 10px; height: 10px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 52%, #5a7186 52%, #5a7186 62%, transparent 62%, transparent 78%, #5a7186 78%); }
  /* The ruler across the top of the in-place editor
     (V0.56.0), ticked at the drawing scale. Like the
     rest of the in-canvas editor it is dark in both
     themes by design. */
  #mtRuler { position: relative; height: 17px; margin-bottom: 4px; background: #1d2835; border: 1px solid #3a4a5a; border-radius: 3px; overflow: hidden; color: #9fb6c9; }
  .mt-stack { flex-direction: column; align-items: stretch; overflow: visible; }
  .mtb.mt-wide { gap: 6px; padding: 4px 10px; font-size: 11px; justify-content: flex-start; }
  .rtab.ctx { color: #9fd6b4; }
  .mtb:hover { background: #2d4a67; }
  /* pre-wrap (V0.72.0): runs of spaces the user
     types must show as typed, in table cells and
     in standalone MTEXT alike; the default white
     space collapsing hid them while editing. */
  #mtBody { background: rgba(10, 10, 10, 0.92); border: 1px dashed #8a8a8a; color: #ffffff; padding: 5px 7px; outline: none; line-height: 1.2; overflow: auto; max-height: 320px; white-space: pre-wrap; }
  .mt-stack { border-bottom: 1px dotted #8a8a8a; padding: 0 1px; }

  /* ---- toolbars (V0.9.4) ---- */
  .ws-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
  .ws-center > .canvas-wrap { flex: 1; min-height: 0; }
  
  #dockLeft { grid-column: 1; }
  .ws-center { grid-column: 2; }
  #dockRight { grid-column: 3; }
  .workspace > .palette { grid-column: 4; }
  .dock { display: flex; gap: 6px; padding: 3px; background: #242424; }
  .dock-h { flex-direction: row; flex-wrap: wrap; align-items: flex-start; border-bottom: 1px solid #161616; }
  #dockBottom { border-top: 1px solid #161616; border-bottom: none; }
  .dock-v { flex-direction: column; flex-wrap: wrap; align-content: flex-start; align-items: flex-start; border-right: 1px solid #161616; }
  #dockRight { border-right: none; border-left: 1px solid #161616; }
  .tb { display: flex; background: #2e2e2e; border: 1px solid #4a4a4a; border-radius: 4px; overflow: hidden; }
  .dock-h .tb { flex-direction: row; }
  .dock-v .tb { flex-direction: column; }
  .tb-grip { display: flex; align-items: center; gap: 4px; background: #3a3a3a; color: #bbbbbb; cursor: grab; padding: 2px 4px; user-select: none; touch-action: none; flex: 0 0 auto; }
  .tb-grip:active { cursor: grabbing; }
  .tb-dots { width: 8px; height: 14px; flex: 0 0 auto; background-image: radial-gradient(circle, #888888 1px, transparent 1.3px); background-size: 4px 4px; }
  .tb-name { font-size: 10px; letter-spacing: 0.04em; white-space: nowrap; }
  .tb-x { cursor: pointer; display: flex; align-items: center; padding: 1px; color: #999999; }
  .tb-x:hover { color: #ffffff; }
  .tb-x svg { width: 10px; height: 10px; }
  .tb-btns { display: flex; gap: 3px; padding: 3px; align-items: flex-start; }
  .dock-h .tb-btns { flex-direction: row; flex-wrap: wrap; }
  .dock-v .tb-btns { flex-direction: column; }
  /* One button wide in a vertical dock
     (V0.25.3): the grip's name label stretched
     the toolbar box to 58 to 89 px around a
     34 px button column, so the name hides
     here and the grip is just dots and the
     close box. Horizontal docks and floating
     toolbars keep their names. */
  .dock-v .tb-grip .tb-name { display: none; }
  /* The close box hides in vertical docks
     too: at one button wide it sat on the
     grip's natural grab point, so a grab
     meant to drag closed the toolbar. Docked
     toolbars are hidden from the Toolbars
     menu instead (the standard way); floating
     toolbars keep their close box. */
  .dock-v .tb-grip .tb-x { display: none; }
  .tb-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: 1px solid #4a4a4a; background: #333333; border-radius: 3px; cursor: pointer; color: #eeeeee; flex: 0 0 auto; }
  .tb-btn:hover { background: #2d4a67; }
  .tb-btn svg.icon { width: 17px; height: 17px; }
  .tb-layer-sel { max-width: 132px; background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; height: 28px; align-self: center; }
  .tb-float, .dock-panel.tb-float { position: fixed; z-index: 4500; flex-direction: column; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); }
  /* Floated panels are solid and laid out (V0.73.4):
     the float rule above carries no background and
     no display, and the base .dock-panel carries no
     background either. A panel root that paints its
     own background (Properties, Layers) floated
     fine, but References paints none, so afloat its
     list body was transparent over the drawing, and
     with the root not a flex container its body
     wrapper never took the panel height, so the
     list did not fill and the footer sat mid panel.
     A floated panel now takes the panels' shared
     surface (#262626 dark, #f0f0f0 light, the
     Layers value in both themes) and lays out as
     the same flex column it is when docked, so
     fill regions fill and footers anchor at the
     bottom. The panel drag adds tb-float mid
     gesture, so the drag frame is solid too. */
  .dock-panel.tb-float { display: flex; background: #262626; }
  body[data-theme="light"] .dock-panel.tb-float { background: #f0f0f0; }
  .tb-float .tb-btns { flex-direction: row; flex-wrap: wrap; max-width: 248px; }
  .tb-dragging { opacity: 0.88; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.6); }
  /* Lite drag (V0.25.2): while a panel is being
     dragged, only its header stays visible; the
     body is display none so the compositor is
     moving a header and an empty frame instead
     of rasterizing the panel's full contents
     (540 layer rows took about a second to
     start moving). The frame also drops the
     drag shadow and fade, which are paint work
     on the same layer. */
  .dock-panel.tb-drag-lite { box-shadow: none; opacity: 1; }
  .tb-drag-lite > * { display: none !important; }
  .tb-drag-lite > .palette-header { display: flex !important; }
  .install-btn[hidden] { display: none !important; }
  .tb-menu-btn { cursor: pointer; padding: 4px 10px; border: 1px solid #4a4a4a; border-radius: 3px; background: #333333; color: #dddddd; font-size: 12px; user-select: none; }
  .tb-menu-btn:hover { border-color: #57a773; color: #ffffff; }
  .tb-menu { position: fixed; z-index: 6000; background: #262626; border: 1px solid #4a4a4a; border-radius: 5px; padding: 5px; min-width: 172px; box-shadow: 0 12px 26px rgba(0, 0, 0, 0.5); }
  .tb-menu-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; cursor: pointer; color: #dddddd; font-size: 12.5px; border-radius: 3px; user-select: none; }
  .tb-menu-row:hover { background: #2d4a67; }
  .tb-check { width: 11px; height: 11px; border: 1px solid #666666; border-radius: 2px; flex: 0 0 auto; }
  .tb-check.on { background: #57a773; border-color: #57a773; }
  .tb-drag-on .dock { display: flex !important; min-width: 24px; min-height: 24px; background: rgba(87, 167, 115, 0.07); }
  .tb-drag-on .dock.dock-over { background: rgba(87, 167, 115, 0.28); }
  /* ---- panels in the dock system (V0.9.5) ---- */
  .palette { width: 264px; flex: 0 0 auto; }
  .palette-header { cursor: grab; justify-content: flex-start; gap: 8px; }
  .palette-header:active { cursor: grabbing; }
  .palette-header .pal-close { margin-left: 0; cursor: pointer; display: flex; align-items: center; }
  .palette-header .pal-cluster { margin-left: auto; display: flex; align-items: center; gap: 2px; }
  .dock-v > .palette { align-self: stretch; }
  .dock-h > .palette { height: 250px; }
  .palette.tb-float { max-height: calc(100vh - 50px); border: 1px solid #4a4a4a; border-radius: 5px; overflow: hidden; }
  .tb-menu-sect { font-size: 10.5px; color: #8a8a8a; padding: 6px 8px 2px; letter-spacing: 0.05em; user-select: none; }
  .mask-row { display: flex; gap: 18px; align-items: center; margin: 10px 0 2px; flex-wrap: wrap; }
  .mask-check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
  .mask-group { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
  .pg-group { border: 1px solid #3a3a3a; border-radius: 6px; margin: 12px 0 0; padding: 2px 12px 10px; }
  .pg-group legend { padding: 0 6px; font-size: 11px; color: #9db8d2; letter-spacing: 0.04em; }
  .pg-group .mask-group { margin-top: 8px; }
  .pg-note { font-size: 11px; color: #999999; margin-top: 6px; }
  .pg-dims { font-size: 12px; color: #dddddd; }
  .pg-scale input { width: 64px; }
  body[data-theme="light"] .pg-group { border-color: #c4c4c4; }
  body[data-theme="light"] .pg-group legend { color: #33506e; }
  body[data-theme="light"] .pg-note { color: #666666; }
  body[data-theme="light"] .pg-dims { color: #1c1c1c; }
  .mask-group > span, .mask-group > label:first-child { min-width: 86px; }
  .mask-group input[type="text"] { width: 110px; }
  /* ---- settings dialog (V0.9.9) ---- */
  .set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 10px 0; font-size: 12px; color: #cccccc; }
  .ins-pick-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 8px; font-size: 12px; color: #cccccc; }
  .ins-pick-row select { flex: 1; background: #1d1d1d; color: #eeeeee; border: 1px solid #4a4a4a; border-radius: 3px; padding: 5px 6px; font-size: 13px; }
  .ins-thumb-big { width: 100%; background: #10151b; border: 1px solid #3a3a3a; border-radius: 4px; display: block; }
  .ins-sub { font-size: 11px; color: #9a9a9a; margin-top: 6px; }
  .ins-cols { display: flex; gap: 14px; align-items: flex-start; }
  .ins-left { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
  .ins-right { width: 180px; flex: none; }
  .ins-group { border: 1px solid #3a3a3a; border-radius: 6px; padding: 6px 10px 8px; margin: 0; }
  .ins-group legend { font-size: 11px; color: #9a9a9a; padding: 0 4px; }
  .ins-chk { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #cccccc; margin: 3px 0; }
  .ins-xy { display: flex; gap: 8px; flex-wrap: wrap; }
  .ins-xy label { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #cccccc; }
  .ins-xy input { width: 76px; background: #1d1d1d; color: #eeeeee; border: 1px solid #4a4a4a; border-radius: 3px; padding: 4px 6px; }
  .ins-xy input:disabled { opacity: 0.45; }
  .purge-group { font-size: 12px; font-weight: 600; color: #cccccc; margin: 10px 0 4px; }
  .purge-tabs { display: flex; gap: 8px; margin-bottom: 8px; }
  .purge-cols { display: flex; gap: 14px; align-items: flex-start; }
  .purge-left { flex: 1; min-width: 0; }
  .purge-right { width: 212px; flex: none; }
  .purge-pane-title { font-size: 12px; font-weight: 600; color: #cccccc; margin-bottom: 4px; }
  #purgeTree, #purgeKept { max-height: 308px; overflow-y: auto; border: 1px solid #3a3a3a; border-radius: 4px; padding: 6px; }
  .pg-row { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #eeeeee; padding: 1px 0; cursor: pointer; }
  .pg-row.cat { font-weight: 600; margin-top: 5px; }
  .pg-row.item { padding-left: 24px; }
  .pg-row.root { font-weight: 700; }
  .pg-kept-row { font-size: 12px; color: #cccccc; padding: 2px 0; }
  #aliasList { max-height: 340px; overflow-y: auto; margin: 8px 0; }
  .alias-row { display: flex; align-items: center; gap: 10px; margin: 4px 0; }
  .alias-row .alias-cmd { width: 132px; flex: none; font-size: 12px; color: #eeeeee; font-weight: 600; }
  .alias-row input { flex: 1; background: #1d1d1d; color: #eeeeee; border: 1px solid #4a4a4a; border-radius: 3px; padding: 4px 6px; }
  .alias-cat { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #9fb4c8; margin: 10px 0 2px; }
  #tplList { max-height: 320px; overflow-y: auto; margin: 8px 0; }
  /* Template table (V0.84.33): a real themed table on the
     STYLEIMPORT table pattern, both themes, with the New
     Drawing default marked by a pill and a tinted row so the
     active choice is obvious at a glance. */
  .tpl-table-wrap { border: 1px solid #3a3a3a; border-radius: 4px; overflow: hidden; }
  body[data-theme="light"] .tpl-table-wrap { border-color: #c4c4c4; }
  .tpl-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; }
  .tpl-table col.tpl-col-size { width: 84px; }
  .tpl-table col.tpl-col-actions { width: 300px; }
  .tpl-table thead th { text-align: left; padding: 5px 8px; background: #262626; border-bottom: 1px solid #3a3a3a; font-weight: bold; color: #ffffff; }
  body[data-theme="light"] .tpl-table thead th { background: #e9e9e9; border-bottom-color: #c4c4c4; color: #1c1c1c; }
  .tpl-table td { padding: 5px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); vertical-align: middle; color: #eeeeee; }
  body[data-theme="light"] .tpl-table td { border-bottom-color: rgba(0, 0, 0, 0.08); color: #1c1c1c; }
  .tpl-table td.tpl-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tpl-table td.tpl-size { text-align: right; font-weight: normal; }
  .tpl-table tr.tpl-default-row td { background: rgba(87, 167, 115, 0.14); }
  body[data-theme="light"] .tpl-table tr.tpl-default-row td { background: #dcecdf; }
  .tpl-pill { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 9px; background: #244434; border: 1px solid #57a773; color: #ffffff; font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
  .tpl-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
  .tpl-guide { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 8px; font-size: 12.5px; color: #dddddd; border: 1px solid #3a3a3a; border-radius: 4px; }
  body[data-theme="light"] .tpl-guide { color: #1c1c1c; border-color: #c4c4c4; }
  .tpl-empty { padding: 10px 8px; font-size: 12.5px; color: #9fb4c8; }
  body[data-theme="light"] .tpl-empty { color: #5a6b7a; }
  .set-row input[type="number"] { width: 84px; background: #1d1d1d; color: #eeeeee; border: 1px solid #4a4a4a; border-radius: 3px; padding: 4px 6px; }
  .set-row input[type="checkbox"] { width: 16px; height: 16px; }
  /* Options dialog (V0.28.0), modeled on
     the reference dialog: tabs across the top, grouped
     fieldsets, sliders with number boxes and
     preview wells. Dark is the base theme;
     the light overrides sit with the other
     body[data-theme="light"] rules below. */
  .recent-menu { position: fixed; z-index: 4900; min-width: 250px; max-width: 360px; background: #2b2b2b; color: #e8e8e8; border: 1px solid #555555; box-shadow: 0 6px 18px rgba(0,0,0,0.45); padding: 4px; }
  .recent-item { padding: 5px 8px; cursor: pointer; }
  .recent-item:hover { background: #3a6ea5; color: #ffffff; }
  .recent-item:hover .recent-sub { color: #cfe0f2; }
  .recent-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .recent-sub { font-size: 11px; color: #9a9a9a; }
  .recent-empty { padding: 6px 8px; font-size: 12px; color: #9a9a9a; }
  .recent-clear { border-top: 1px solid #555555; margin-top: 4px; }
  body[data-theme="light"] .recent-menu { background: #f5f5f5; color: #1c1c1c; border-color: #b5b5b5; }
  body[data-theme="light"] .recent-sub { color: #666666; }
  .lock-google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 14px; padding: 9px 12px; background: #ffffff; color: #1f1f1f; border: 1px solid #dadce0; border-radius: 6px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
  .lock-google-btn:hover { background: #f1f5fb; }
  .lock-google-btn .g-badge { color: #4285f4; font-size: 17px; font-weight: 800; line-height: 1; }
  .lock-or { text-align: center; font-size: 11.5px; opacity: .65; margin: 12px 0 2px; }
  .lock-note { text-align: center; font-size: 11px; opacity: .55; margin-top: 8px; }
  .drive-list { max-height: 300px; overflow-y: auto; border: 1px solid #3a3a3a; border-radius: 6px; margin-top: 6px; }
  body[data-theme="light"] .drive-list { border-color: #c4c4c4; }
  .drive-item { padding: 7px 10px; cursor: pointer; }
  .drive-item.folder .drive-name { font-weight: 600; }
  .drive-item.sel { background: #2c4a6e; color: #ffffff; }
  body[data-theme="light"] .drive-item.sel { background: #cfe0f2; color: #1c1c1c; }
  .save-menu { min-width: 220px; }
  .ds-path { font-size: 12px; color: #9a9a9a; margin-top: 2px; }
  body[data-theme="light"] .ds-path { color: #666666; }
  .drive-item:hover { background: #3a6ea5; color: #ffffff; }
  .drive-item:hover .drive-sub { color: #cfe0f2; }
  /* ---- V0.64.0: annotative glyph, toolbar dropdowns, Windows style Drive dialogs ---- */
  .anno-glyph { display: inline-block; width: 13px; height: 13px; margin-right: 5px; vertical-align: -2px; }
  .tb-layer-swatch { width: 14px; height: 14px; border: 1px solid #4a4a4a; border-radius: 2px; align-self: center; flex: 0 0 auto; }
  .tb-dd { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; cursor: pointer; font-size: 12px; align-self: center; user-select: none; white-space: nowrap; }
  .tb-dd:hover { border-color: #57a773; }
  .tb-dd .tb-dd-val { overflow: hidden; text-overflow: ellipsis; }
  .tb-dd .tb-dd-sw { width: 12px; height: 12px; border: 1px solid #4a4a4a; border-radius: 2px; flex: 0 0 auto; }
  .tb-dd svg.rm-ico { width: 10px; height: 10px; flex: 0 0 auto; }
  body[data-theme="light"] .tb-dd { background: #ffffff; color: #1c1c1c; border-color: #b9c4cf; }
  body[data-theme="light"] .tb-layer-swatch, body[data-theme="light"] .tb-dd .tb-dd-sw { border-color: #b9c4cf; }
  .tb-pop { position: fixed; z-index: 6000; background: #262626; border: 1px solid #4a4a4a; border-radius: 5px; padding: 4px; min-width: 176px; max-height: 330px; overflow-y: auto; box-shadow: 0 12px 26px rgba(0, 0, 0, 0.5); }
  body[data-theme="light"] .tb-pop { background: #ffffff; border-color: #b9c4cf; }
  .tb-pop-item { display: flex; align-items: center; gap: 7px; padding: 5px 8px; cursor: pointer; color: #dddddd; font-size: 12.5px; border-radius: 3px; user-select: none; white-space: nowrap; }
  body[data-theme="light"] .tb-pop-item { color: #1c1c1c; }
  .tb-pop-item:hover { background: #2d4a67; color: #ffffff; }
  body[data-theme="light"] .tb-pop-item:hover { background: #cfe0f2; color: #1c1c1c; }
  .tb-pop-item.cur { font-weight: 600; }
  .tb-pop-sep { height: 1px; background: #4a4a4a; margin: 4px 6px; }
  body[data-theme="light"] .tb-pop-sep { background: #c4cdd6; }
  .tb-pop-item .anno-chk { width: 14px; flex: 0 0 auto; text-align: center; }
  .tb-pop-item .tb-dd-sw { width: 12px; height: 12px; border: 1px solid #4a4a4a; border-radius: 2px; flex: 0 0 auto; }
  body[data-theme="light"] .tb-pop-item .tb-dd-sw { border-color: #b9c4cf; }
  .tb-pop-item .tb-lt-prev { flex: 0 0 auto; }
  .dwin-head, .dwin .drive-item { display: grid; grid-template-columns: minmax(140px, 1fr) 148px 104px 74px; gap: 10px; align-items: center; }
  .dwin-head { padding: 5px 10px; font-size: 11.5px; color: #9a9a9a; border-bottom: 1px solid #3a3a3a; }
  body[data-theme="light"] .dwin-head { color: #666666; border-color: #c4c4c4; }
  .dwin .drive-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dwin .drive-cell { font-size: 12px; color: #bbbbbb; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body[data-theme="light"] .dwin .drive-cell { color: #555555; }
  .dwin .drive-item:hover .drive-cell { color: #cfe0f2; }
  body[data-theme="light"] .dwin .drive-item:hover .drive-cell { color: #555555; }
  .dwin .drive-item.sel .drive-cell { color: #ffffff; }
  body[data-theme="light"] .dwin .drive-item.sel .drive-cell { color: #1c1c1c; }
  .dwin-nav { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
  .dwin-nav .ds-path { flex: 1; margin-top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dwin-type { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 12px; color: #cccccc; }
  body[data-theme="light"] .dwin-type { color: #40536a; }
  .dwin-type label { padding-left: 2px; }
  .dwin-type select { flex: 1; }
  .dp-rows { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
  .dp-row { display: flex; gap: 12px; font-size: 12.5px; }
  .dp-row .dp-k { width: 118px; flex: 0 0 auto; color: #9a9a9a; padding-left: 2px; }
  body[data-theme="light"] .dp-row .dp-k { color: #666666; }
  .dp-row .dp-v { flex: 1; color: #eeeeee; word-break: break-all; }
  body[data-theme="light"] .dp-row .dp-v { color: #1c1c1c; }
  .drive-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .drive-sub { font-size: 11px; opacity: .6; }
  .drive-empty { padding: 12px 10px; font-size: 12.5px; opacity: .7; }
  body[data-theme="light"] .recent-clear { border-top-color: #cccccc; }
  .roll-tip { position: fixed; z-index: 4800; pointer-events: none; background: #ffffe1; color: #1c1c1c; border: 1px solid #767676; box-shadow: 2px 2px 4px rgba(0,0,0,0.35); padding: 3px 7px 4px; font-size: 12px; line-height: 1.3; min-width: 120px; }
  .roll-tip .rt-head { font-weight: 600; }
  .roll-tip .rt-row { display: flex; gap: 10px; line-height: 1.3; }
  .roll-tip .rt-k { color: #444444; }
  .roll-tip .rt-v { margin-left: auto; text-align: right; }
  body[data-theme="light"] .roll-tip { background: #ffffe1; color: #1c1c1c; border-color: #767676; }
  .patdraw-panel { position: fixed; top: 44px; left: 50%; transform: translateX(-50%); z-index: 4700; display: flex; align-items: center; gap: 10px; background: #1d1d1d; color: #dddddd; border: 1px solid #3a3a3a; border-radius: 6px; padding: 8px 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); font-size: 13px; max-width: min(880px, 94vw); }
  body[data-theme="light"] .patdraw-panel { background: #f5f5f5; color: #1c1c1c; border-color: #c8c8c8; }
  .opt-card { width: 780px; max-width: 96vw; }
  .opt-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: #aaaaaa; margin: 2px 0 10px; }
  /* Shared tabs (V0.71.0): ONE tab component for
     every dialog that switches pages, the classic
     look Chris asked for: the active tab is raised
     and its bottom edge merges into the page body
     (its background is the card's, and it overlaps
     the strip's bottom border by a pixel), inactive
     tabs sit recessed with muted text. No
     transitions: the suites read computed colors
     synchronously, and a tab should not fade.
     .ssc-pages is the bordered body for containers
     that wrap their pages; .ssc-pagebox borders
     each page where the pages are siblings. */
  .ssc-tabs { display: flex; flex-wrap: wrap; gap: 2px; align-items: flex-end; border-bottom: 1px solid #3a3a3a; margin-top: 10px; padding: 0 4px; }
  .ssc-tab { font: inherit; font-size: 12px; background: #262626; color: #bdbdbd; border: 1px solid #3a3a3a; border-bottom: none; border-radius: 5px 5px 0 0; padding: 6px 12px; cursor: pointer; position: relative; }
  .ssc-tab:hover { background: #2e2e2e; color: #ffffff; }
  .ssc-tab.active { background: #1d1d1d; color: #ffffff; margin-bottom: -1px; padding-bottom: 7px; z-index: 1; }
  .ssc-pages { border: 1px solid #3a3a3a; border-top: none; }
  .ssc-pagebox { border: 1px solid #3a3a3a; border-top: none; padding: 10px; }
  /* Border preset icon buttons (V0.71.0): the glyph
     is an inline SVG in currentColor, so it takes
     the button's themed text color in both themes. */
  .bd-preset-btn { padding: 3px 6px; line-height: 0; }
  .bd-preset-btn svg { display: block; }
  .opt-pages { padding: 12px 6px 2px 2px; }
  .opt-pages::-webkit-scrollbar { width: 8px; height: 8px; }
  .opt-pages::-webkit-scrollbar-thumb { background: rgba(110, 160, 210, 0.45); border-radius: 4px; }
  .opt-pages::-webkit-scrollbar-track { background: transparent; }
  .opt-page { display: none; }
  .opt-page.active { display: block; }
  .opt-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
  /* LTMAKER breathing room (V0.33.0, Chris's
     screenshot): the maker packed its rows tight;
     the card and its rows get real padding. */
  #ltMakerDialog .modal-card { padding: 20px 22px 16px; }
  /* STYLEIMPORT selection table (V0.67.1, Chris: "the
     dialog grows way to big when selecting a DXF" and
     "There needs to be a table that I can select the
     styles and sorted by type"). The card is a fixed
     footprint flex column; the table body scrolls
     inside it and long names truncate. */
  #styleImportDialog .modal-card { width: 640px; max-width: 96vw; height: min(620px, 90vh); display: flex; flex-direction: column; }
  #siFamilies { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin: 8px 0 2px; }
  .si-table-wrap { flex: 1 1 auto; min-height: 0; overflow-y: auto; border: 1px solid #3a3a3a; border-radius: 4px; }
  body[data-theme="light"] .si-table-wrap { border-color: #c4c4c4; }
  .si-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; }
  .si-table col.si-col-cb { width: 36px; }
  .si-table col.si-col-type { width: 140px; }
  .si-table thead th { position: sticky; top: 0; z-index: 1; text-align: left; padding: 5px 8px; background: #262626; border-bottom: 1px solid #3a3a3a; font-weight: bold; color: #ffffff; }
  body[data-theme="light"] .si-table thead th { background: #e9e9e9; border-bottom-color: #c4c4c4; color: #1c1c1c; }
  .si-table td { padding: 4px 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); vertical-align: middle; }
  body[data-theme="light"] .si-table td { border-bottom-color: rgba(0, 0, 0, 0.08); }
  .si-table tr.si-row { cursor: pointer; }
  .si-table tr.si-row:hover { background: rgba(110, 160, 210, 0.13); }
  .si-table td.si-cb-cell { text-align: center; }
  .si-table td.si-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .si-table tr.si-group td { background: #26303a; font-weight: bold; color: #ffffff; }
  body[data-theme="light"] .si-table tr.si-group td { background: #dde5ee; color: #1c1c1c; }
  .si-table tr.si-group label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
  .si-table tr.si-empty td { color: #9fb4c8; padding: 10px; }
  body[data-theme="light"] .si-table tr.si-empty td { color: #5a6b7a; }
  /* STYLEIMPORT view controls (V0.68.0, Chris):
     the search box and type filter above the
     table, and the per-family collapse toggle in
     each group row. Collapsing hides a family's
     rows; its checks are untouched and still
     import. The group cell becomes a flex row so
     the toggle and the family label sit inline. */
  #siControls { margin: 8px 0 0; }
  #siControls .si-search { flex: 1 1 auto; min-width: 0; }
  .si-table tr.si-group td { display: flex; align-items: center; }
  .si-table tr.si-group .si-collapse { flex: 0 0 16px; text-align: center; cursor: pointer; font-weight: bold; user-select: none; }
  .si-table tr.si-group .si-fam-count { font-weight: normal; opacity: 0.85; }
  #ltMakerDialog .ins-row { margin: 10px 0; gap: 10px; }
  #ltMakerDialog #ltmPreview { margin: 8px 0 4px; }
  #ltMakerDialog .ins-sub { line-height: 1.5; margin: 8px 0 4px; }
  #ltMakerDialog .modal-btns { margin-top: 12px; gap: 8px; }
  /* Pattern Maker size (V0.34.0, Chris's report):
     a From Drawing conversion can fill the maker
     with a dozen families, and the card grew past
     the screen. The card is capped and its list
     scrolls; the preview and buttons stay put. */
  #patMakerDialog .modal-card { max-height: 88vh; display: flex; flex-direction: column; padding: 22px 24px 18px; }
  #patMakerDialog .modal-title { margin-bottom: 10px; }
  #patMakerDialog .ins-row { margin: 9px 0; }
  #patMakerDialog .ins-sub { line-height: 1.55; margin: 10px 0 6px; }
  #patMakerDialog #pmPreview { flex: none; margin: 10px 0 8px; }
  #patMakerDialog .modal-btns { margin-top: 14px; }
  /* The Pattern Editor bar (V0.35.8): the
     Block Editor style strip that owns the
     screen while a pattern is being drawn. */
  .pat-editor-bar { gap: 12px; padding: 10px 14px; flex-wrap: wrap; justify-content: center; }
  .pat-editor-bar .pat-ed-name { width: 180px; }
  .pat-editor-bar .pat-ed-hint { color: #9a9a9a; font-size: 12px; }
  body[data-theme="light"] .pat-editor-bar .pat-ed-hint { color: #5a6a76; }
  /* Width fit (V0.32.0, Chris's screenshots): the
     fixed width selects and the slider rows could
     not shrink below their content, so the right
     column ran off the card on narrower windows.
     Groups, rows, and controls may all shrink now;
     the columns stay equal and centered on the tab. */
  .opt-group { min-width: 0; }
  .opt-row { min-width: 0; }
  .opt-row label { min-width: 0; }
  .opt-row select { min-width: 0; }
  .opt-row input[type="range"] { min-width: 40px; }
  .opt-row input[type="number"] { min-width: 0; }
  @media (max-width: 700px) { .opt-cols { grid-template-columns: 1fr; } }
  .opt-group { border: 1px solid #3a3a3a; border-radius: 6px; padding: 6px 10px 8px; margin: 0 0 10px; }
  .opt-group legend { font-size: 12px; color: #aaaaaa; padding: 0 5px; }
  .opt-row { display: flex; align-items: center; gap: 9px; margin: 5px 0; font-size: 12px; color: #dddddd; }
  .opt-row label { flex: 1; padding-right: 4px; }
  .opt-row.sld label { flex: 0 0 118px; }
  .opt-row select { width: 196px; background: #1d1d1d; color: #eeeeee; border: 1px solid #4a4a4a; border-radius: 3px; padding: 4px 6px; }
  .opt-row input[type="number"] { width: 64px; background: #1d1d1d; color: #eeeeee; border: 1px solid #4a4a4a; border-radius: 3px; padding: 4px 6px; }
  .opt-row input[type="range"] { flex: 1; accent-color: #4da3ff; }
  .opt-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: #4da3ff; flex: none; }
  .opt-unit { color: #999999; flex: none; }
  .opt-note { font-size: 11.5px; color: #999999; line-height: 1.45; margin: 4px 0; }
  /* Fit (V0.31.0): the pages never scroll (Chris's
     standing rule) and the compacted pages fit a
     600 px window outright. On a window shorter
     than the dialog itself, the BACKDROP scrolls
     instead, so every control stays reachable and
     nothing is ever clipped off the dialog. */
  #settingsDialog { overflow-y: auto; }
  #settingsDialog .modal-card { margin: auto; }
  .opt-preview { background: #000000; border: 1px solid #3a3a3a; border-radius: 4px; height: 40px; display: flex; align-items: center; justify-content: center; margin: 5px 0 2px; }
  .opt-preview-box { border: 1.5px solid #57a773; width: 30px; height: 30px; }
  .opt-preview-grip { background: #4da3ff; border: 1px solid #ffffff; width: 7px; height: 7px; }
  .opt-stack-btns { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
  .opt-stack-btns .mbtn { text-align: center; }

  /* ---- panel resizing and auto-hide (V0.9.8) ---- */
  .workspace .dock-panel { position: relative; }
  .palette-header .pal-pin { margin-left: 0; cursor: pointer; display: flex; align-items: center; color: #8a8a8a; padding: 3px; }
  .palette-header .pal-pin .icon { width: 12px; height: 12px; }
  .palette-header .pal-pin:hover { color: #dddddd; }
  .palette-header .pal-pin.on { color: #9fd6b4; }
  .palette-header .pal-close { margin-left: 0; }
  .pz { position: absolute; z-index: 6; display: none; }
  .pz-e { right: 0; top: 0; bottom: 0; width: 4px; cursor: ew-resize; }
  .pz-w { left: 0; top: 0; bottom: 0; width: 4px; cursor: ew-resize; }
  .pz-s { left: 0; right: 0; bottom: 0; height: 4px; cursor: ns-resize; }
  .pz-n { left: 0; right: 0; top: 0; height: 4px; cursor: ns-resize; }
  .pz-se { right: 0; bottom: 0; width: 10px; height: 10px; cursor: nwse-resize; z-index: 7; }
  /* Defined panel boundaries (V0.65.0, Chris):
     docked panels carry a full border with real
     contrast in both themes, so two panels stacked
     in a dock read as two panels with a boundary
     that can be found, and the resize handles
     paint as a visible splitter band at rest,
     brighter under the pointer. A floating panel
     keeps its own outline: .palette.tb-float
     outranks .dock-panel, so this changes nothing
     for floats. Global border-box sizing means the
     added borders cannot move any layout sizes. */
  .dock-panel { border: 1px solid #5a5a5a; }
  body[data-theme="light"] .dock-panel { border-color: #8c8c8c; }
  .pz-e, .pz-w, .pz-s, .pz-n { background: #4a4a4a; }
  body[data-theme="light"] .pz-e, body[data-theme="light"] .pz-w, body[data-theme="light"] .pz-s, body[data-theme="light"] .pz-n { background: #a6a6a6; }
  .pz-e:hover, .pz-w:hover, .pz-s:hover, .pz-n:hover { background: #57a773; }
  /* The light theme's resting band rule outranks
     the generic hover rule above (V0.67.0, Chris:
     the splitter highlight exists in dark mode
     only), so light mode gets its own hover rule
     at matching specificity. The accent is the
     app's green in both themes. */
  body[data-theme="light"] .pz-e:hover, body[data-theme="light"] .pz-w:hover, body[data-theme="light"] .pz-s:hover, body[data-theme="light"] .pz-n:hover { background: #57a773; }
  /* Panel corner grips (V0.67.0): the four corner
     handles drag diagonally; diagonal grip lines
     paint the corner in both themes and turn the
     accent green under the pointer, like the edge
     splitter bands beside them. */
  .pz-sw { left: 0; bottom: 0; width: 10px; height: 10px; cursor: nesw-resize; z-index: 7; }
  .pz-ne { right: 0; top: 0; width: 10px; height: 10px; cursor: nesw-resize; z-index: 7; }
  .pz-nw { left: 0; top: 0; width: 10px; height: 10px; cursor: nwse-resize; z-index: 7; }
  .pz-se { background-image: repeating-linear-gradient(135deg, transparent 0px, transparent 2px, #5a5a5a 2px, #5a5a5a 3px); }
  .pz-nw { background-image: repeating-linear-gradient(135deg, transparent 0px, transparent 2px, #5a5a5a 2px, #5a5a5a 3px); }
  .pz-sw { background-image: repeating-linear-gradient(45deg, transparent 0px, transparent 2px, #5a5a5a 2px, #5a5a5a 3px); }
  .pz-ne { background-image: repeating-linear-gradient(45deg, transparent 0px, transparent 2px, #5a5a5a 2px, #5a5a5a 3px); }
  body[data-theme="light"] .pz-se, body[data-theme="light"] .pz-nw { background-image: repeating-linear-gradient(135deg, transparent 0px, transparent 2px, #a6a6a6 2px, #a6a6a6 3px); }
  body[data-theme="light"] .pz-sw, body[data-theme="light"] .pz-ne { background-image: repeating-linear-gradient(45deg, transparent 0px, transparent 2px, #a6a6a6 2px, #a6a6a6 3px); }
  .pz-se:hover, .pz-nw:hover { background-image: repeating-linear-gradient(135deg, transparent 0px, transparent 2px, #57a773 2px, #57a773 3px); }
  .pz-sw:hover, .pz-ne:hover { background-image: repeating-linear-gradient(45deg, transparent 0px, transparent 2px, #57a773 2px, #57a773 3px); }
  body[data-theme="light"] .pz-se:hover, body[data-theme="light"] .pz-nw:hover { background-image: repeating-linear-gradient(135deg, transparent 0px, transparent 2px, #57a773 2px, #57a773 3px); }
  body[data-theme="light"] .pz-sw:hover, body[data-theme="light"] .pz-ne:hover { background-image: repeating-linear-gradient(45deg, transparent 0px, transparent 2px, #57a773 2px, #57a773 3px); }
  .ah-collapsed > *:not(.palette-header):not(.pz) { display: none !important; }
  .dock-v > .ah-collapsed .palette-header, .anchor-bar > .ah-collapsed .palette-header { writing-mode: vertical-rl; height: 100%; justify-content: center; }
  .dock-v > .ah-collapsed .palette-header .tb-dots, .dock-v > .ah-collapsed .palette-header .pal-pin, .dock-v > .ah-collapsed .palette-header .pal-close, .anchor-bar > .ah-collapsed .palette-header .tb-dots, .anchor-bar > .ah-collapsed .palette-header .pal-pin, .anchor-bar > .ah-collapsed .palette-header .pal-close { display: none; }
  .ah-overlay { position: fixed !important; z-index: 4600; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5); border: 1px solid #4a4a4a; border-radius: 4px; }
  .ah-ph { visibility: hidden; }
  .dock-v > .dock-panel.ah-collapsed { min-height: 0; }
  .dock-h > .dock-panel.ah-collapsed { min-width: 0; }
  /* The anchor bar (V0.35.6): a side's
     tucked panels live here, at the edge
     facing the drawing area, outside the
     dock column. The host makes room for
     it on that side only while it is in
     use, so the column itself is never
     narrowed and never shortened. */
  .dock-v { position: relative; }
  .anchor-bar { position: absolute; top: 3px; bottom: 3px; width: 30px; display: flex; flex-direction: column; gap: 6px; z-index: 5; }
  .anchor-bar:empty { display: none; }
  #dockRight .anchor-bar { left: 3px; }
  #dockLeft .anchor-bar { right: 3px; }
  #dockRight.has-anchored { padding-left: 39px; }
  #dockLeft.has-anchored { padding-right: 39px; }
  .anchor-bar > .dock-panel { min-height: 0; }

  /* ---- side title bars for panels docked
     left or right (V0.35.0, Chris's spec): the
     title is a vertical strip on the docked
     edge, not a bar across the top. The strip
     is also what an auto hidden panel leaves
     at the edge, and the panel opens from
     that side. Panel content sits in a single
     body wrapper so strip plus body is a row;
     the wrapper is the panel's column in every
     other arrangement. ---- */
  .pal-body { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; min-width: 0; }
  .dock-panel.pal-side-l, .dock-panel.pal-side-r { display: flex; flex-direction: row; }
  .dock-panel.pal-side-r { flex-direction: row-reverse; }
  .pal-side-l .palette-header, .pal-side-r .palette-header {
    writing-mode: vertical-rl; flex: 0 0 30px; width: 30px; height: auto;
    border-bottom: none; justify-content: flex-start; padding: 10px 0;
  }
  .pal-side-l .palette-header { border-right: 1px solid #3a3a3a; }
  .pal-side-r .palette-header { border-left: 1px solid #3a3a3a; }
  .pal-side-l .palette-header .pal-pin, .pal-side-r .palette-header .pal-pin { margin-left: 0; margin-top: 0; }
  .pal-side-l .palette-header .pal-close, .pal-side-r .palette-header .pal-close { margin-left: 0; }
  .pal-side-l .palette-header .pal-cluster, .pal-side-r .palette-header .pal-cluster { margin-left: 0; margin-top: auto; flex-direction: column; writing-mode: horizontal-tb; align-items: center; }
  /* The command area is a grid, so its side
     arrangement is columns instead of a row. */
  #commandArea.pal-side-l, #commandArea.pal-side-r { grid-template-rows: minmax(0, 1fr); }
  #commandArea.pal-side-l { grid-template-columns: 30px minmax(0, 1fr); }
  #commandArea.pal-side-r { grid-template-columns: minmax(0, 1fr) 30px; }
  #commandArea.pal-side-l .palette-header { grid-column: 1; }
  #commandArea.pal-side-l .pal-body { grid-column: 2; }
  #commandArea.pal-side-r .palette-header { grid-column: 2; }
  #commandArea.pal-side-r .pal-body { grid-column: 1; }

  /* ---- layers panel (V0.9.6) ---- */
  .dock-v > .dock-panel { flex: 1 1 0; min-height: 140px; }
  .dock-h > .dock-panel { height: 250px; flex: 0 0 auto; }
  .layers-panel { width: 320px; flex: 0 0 auto; background: #262626; border-left: 1px solid #101010; display: flex; flex-direction: column; min-height: 0; }
  .layers-panel.tb-float { max-height: calc(100vh - 50px); border: 1px solid #4a4a4a; border-radius: 5px; overflow: hidden; }
  .lp-current { padding: 5px 10px; font-size: 11.5px; color: #bbbbbb; border-bottom: 1px solid #3a3a3a; white-space: nowrap; overflow: hidden; }
  .lp-tools { display: flex; gap: 4px; padding: 5px 8px; border-bottom: 1px solid #3a3a3a; }
  .lp-tool { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border: 1px solid #4a4a4a; background: #333333; border-radius: 3px; cursor: pointer; color: #eeeeee; }
  .lp-tool:hover { background: #2d4a67; }
  .lp-tool.disabled { opacity: 0.4; }
  .lp-tool svg.icon { width: 15px; height: 15px; }
  .lp-main { display: flex; flex: 1; min-height: 0; }
  .lp-filters { width: 118px; flex: 0 0 auto; border-right: 1px solid #3a3a3a; padding: 6px 4px; overflow-y: auto; font-size: 11.5px; }
  .lp-fnode { padding: 3px 6px; cursor: pointer; border-radius: 3px; color: #cccccc; white-space: nowrap; }
  .lp-fnode:hover { background: #333333; }
  .lp-fnode.on { background: #2d4a67; color: #ffffff; }
  .lp-fnode.child { margin-left: 12px; color: #8a8a8a; cursor: default; font-size: 11px; }
  .lp-fnode.child:hover { background: none; }
  .lp-table-wrap { flex: 1; overflow: auto; min-width: 0; }
  .lp-table { border-collapse: collapse; font-size: 11.5px; }
  .lp-table th { position: sticky; top: 0; background: #1d1d1d; text-align: left; padding: 4px 6px; color: #bbbbbb; font-weight: normal; border-bottom: 1px solid #3a3a3a; white-space: nowrap; z-index: 1; }
  .lp-table td { padding: 3px 6px; border-bottom: 1px solid #2c2c2c; white-space: nowrap; color: #dddddd; vertical-align: middle; }
  .lp-table tr.sel td { background: #2d4a67; }
  .lp-table .lp-vpcol { display: none; }
  .lp-table.vp-on .lp-vpcol { display: table-cell; }
  .lp-dot { width: 8px; height: 8px; border-radius: 50%; background: #57a773; display: inline-block; }
  .lp-state { cursor: pointer; display: inline-flex; }
  .lp-state.off { opacity: 0.28; }
  .lp-state.dis { opacity: 0.35; cursor: default; }
  .lp-state svg.icon { width: 14px; height: 14px; }
  .lp-name { cursor: pointer; }
  .lp-swatch { width: 10px; height: 10px; display: inline-block; border: 1px solid #555555; margin-right: 5px; vertical-align: -1px; }
  .lp-color { cursor: pointer; }
  .lp-sel { background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; font-size: 11px; padding: 1px 2px; }
  .lp-desc, .lp-rename { background: transparent; border: 1px solid transparent; color: #dddddd; font-size: 11.5px; padding: 1px 3px; width: 130px; }
  .lp-desc:focus, .lp-rename { background: #10151c; border-color: #3a4a5a; border-radius: 3px; outline: none; }
  .lp-dim { color: #8a8a8a; }
  .lp-empty { color: #8a8a8a; padding: 10px; white-space: normal; }
  /* Layers panel parity (V0.84.36): search, status line, invert,
     filter/state tool buttons, sort indicators, in-use marks,
     Varies cells, column visibility, menus and dialogs. Every
     control is themed in both themes; labels carry real padding. */
  .lp-tools2 { display: flex; gap: 4px; padding: 5px 8px; border-bottom: 1px solid #3a3a3a; flex-wrap: wrap; }
  .lp-tbtn { background: #333333; border: 1px solid #4a4a4a; color: #eeeeee; border-radius: 3px; padding: 4px 8px; font-size: 11.5px; cursor: pointer; }
  .lp-tbtn:hover { background: #2d4a67; }
  .lp-searchrow { display: flex; gap: 6px; align-items: center; padding: 5px 8px; border-bottom: 1px solid #3a3a3a; }
  .lp-search-lab { font-size: 11.5px; color: #bbbbbb; padding: 0 2px; white-space: nowrap; }
  .lp-search { flex: 1; min-width: 0; background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 4px 6px; font-size: 11.5px; }
  .lp-search:focus { outline: none; border-color: #57a773; }
  .lp-invertrow { padding: 4px 10px; border-top: 1px solid #3a3a3a; }
  .lp-chk { display: inline-flex; gap: 6px; align-items: center; font-size: 11.5px; color: #cccccc; padding: 2px 0; cursor: pointer; }
  .lp-status { padding: 5px 10px; font-size: 11.5px; color: #bbbbbb; border-top: 1px solid #3a3a3a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lp-inuse { display: inline-block; width: 8px; height: 8px; margin-left: 5px; background: #6db3f2; border-radius: 2px; }
  .lp-notinuse { display: inline-block; width: 8px; height: 8px; margin-left: 5px; border: 1px solid #666666; border-radius: 2px; box-sizing: border-box; opacity: 0.55; }
  .lp-varies { font-style: italic; color: #ffd24d; padding: 0 2px; }
  /* Layers panel performance build: rows stay cheap to paint.
     Off-screen rows skip layout and paint under
     content-visibility while the scroll height stays real (the
     intrinsic size matches the painted row height), and the
     linetype / description cells are read-only display cells
     edited through one shared editor element, so a row carries
     no native form control at all. The native scrollbar and the
     full row set are untouched: no windowing. */
  .lp-table tbody tr { content-visibility: auto; contain-intrinsic-size: auto 22px; }
  .lp-lt-cell, .lp-desc-cell { cursor: pointer; }
  .lp-desc-cell { min-width: 110px; }
  .lp-cell-editor { position: fixed; z-index: 1200; box-sizing: border-box; margin: 0; }
  select.lp-cell-editor { height: auto; }
  .layers-panel.lp-filters-off .lp-filters { display: none; }
  .lp-tbtn[aria-pressed="true"] { background: #2d4a67; color: #ffffff; border-color: #57a773; }
  body[data-theme="light"] .lp-tbtn[aria-pressed="true"] { background: #cfe0f2; color: #111111; border-color: #57a773; }
  body[data-theme="light"] .lp-cell-editor { background: #ffffff; color: #1c1c1c; border-color: #b9c4cf; }
  .lp-table th[data-sort] { cursor: pointer; }
  .lp-table th.sorted { color: #ffffff; }
  .lp-sort-ind { display: inline-block; width: 0; height: 0; margin-left: 5px; vertical-align: middle; border-left: 4px solid transparent; border-right: 4px solid transparent; opacity: 0; }
  .lp-sort-ind.asc { opacity: 1; border-bottom: 6px solid currentColor; }
  .lp-sort-ind.desc { opacity: 1; border-top: 6px solid currentColor; }
  .lp-table.hide-status .lp-c-status, .lp-table.hide-name .lp-c-name, .lp-table.hide-on .lp-c-on, .lp-table.hide-frozen .lp-c-frozen, .lp-table.hide-locked .lp-c-locked, .lp-table.hide-plot .lp-c-plot, .lp-table.hide-color .lp-c-color, .lp-table.hide-linetype .lp-c-linetype, .lp-table.hide-lineweight .lp-c-lineweight, .lp-table.hide-transparency .lp-c-transparency, .lp-table.hide-description .lp-c-description { display: none; }
  .lp-table.hide-vpfreeze .lp-c-vpfreeze, .lp-table.hide-newvpfrozen .lp-c-newvpfrozen, .lp-table.vp-on.hide-vpfreeze .lp-c-vpfreeze, .lp-table.vp-on.hide-newvpfrozen .lp-c-newvpfrozen { display: none; }
  .lp-menu { z-index: 990; width: 252px; }
  .lp-pf-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; border: 1px solid #3a4a5a; border-radius: 4px; padding: 8px 10px; margin: 6px 0; }
  .lp-pf-row label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: #bbbbbb; padding: 0 2px; }
  .lp-pf-in { background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 3px 5px; font-size: 11.5px; }
  .lp-preview-list { max-height: 90px; overflow-y: auto; font-size: 11.5px; color: #9fb4c6; padding: 4px 2px; }
  .lp-group-list { max-height: 260px; overflow-y: auto; border: 1px solid #3a4a5a; border-radius: 4px; padding: 6px; margin-top: 6px; }
  .lp-gf-row { display: flex; gap: 7px; align-items: center; font-size: 12px; color: #dddddd; padding: 3px 6px; cursor: pointer; border-radius: 3px; }
  .lp-gf-row:hover { background: #333333; }
  .lp-state-list { width: 100%; box-sizing: border-box; background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 4px; font-size: 12px; }
  #lpStatesDialog input[type="text"], #lpPropFilterDialog input[type="text"], #lpGroupFilterDialog input[type="text"], #lpMergeDialog select { background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 4px 6px; box-sizing: border-box; }
  body[data-theme="light"] .lp-tbtn { background: #ffffff; border-color: #c4c4c4; color: #1c1c1c; }
  body[data-theme="light"] .lp-tbtn:hover { background: #cfe0f2; }
  body[data-theme="light"] .lp-tools2, body[data-theme="light"] .lp-searchrow, body[data-theme="light"] .lp-invertrow, body[data-theme="light"] .lp-status { border-color: #c9c9c9; }
  body[data-theme="light"] .lp-search-lab, body[data-theme="light"] .lp-status { color: #444444; }
  body[data-theme="light"] .lp-chk { color: #333333; }
  body[data-theme="light"] .lp-search { background: #ffffff; color: #1c1c1c; border-color: #b9c4cf; }
  body[data-theme="light"] .lp-varies { color: #8a6d00; }
  body[data-theme="light"] .lp-table th.sorted { color: #111111; }
  body[data-theme="light"] .lp-notinuse { border-color: #999999; }
  body[data-theme="light"] .lp-inuse { background: #1a5fb4; }
  body[data-theme="light"] .lp-pf-row { border-color: #b9c4cf; }
  body[data-theme="light"] .lp-pf-row label { color: #40536a; }
  body[data-theme="light"] .lp-pf-in, body[data-theme="light"] .lp-state-list, body[data-theme="light"] #lpStatesDialog input[type="text"], body[data-theme="light"] #lpPropFilterDialog input[type="text"], body[data-theme="light"] #lpGroupFilterDialog input[type="text"], body[data-theme="light"] #lpMergeDialog select { background: #ffffff; color: #1c1c1c; border-color: #b9c4cf; }
  body[data-theme="light"] .lp-preview-list { color: #40536a; }
  body[data-theme="light"] .lp-group-list { border-color: #b9c4cf; }
  body[data-theme="light"] .lp-gf-row { color: #1c1c1c; }
  body[data-theme="light"] .lp-gf-row:hover { background: #e2e2e2; }
  .lp-color-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
  /* Panel scrollers (V0.84.36, Chunk A): a full-size 15px bar with an
     always-visible themed thumb in both themes, so the bar is a real
     grab target at any layer count. No scroller code changed: native
     dragging was always intact; the old thin, transparent-at-rest
     styling was the defect. The shared panel pattern (below) carries
     the same values for every panel scroll area. */
.lp-filters, .lp-table-wrap, .palette-body, .layers-box, .command-history, .suggest, .tw-body, #mtBody, .mt-tools, .rp-list, .opt-pages, .dim-pages, #osList, .help-main, #helpList, .drive-list { scrollbar-width: auto; scrollbar-color: rgba(110, 160, 210, 0.55) rgba(255, 255, 255, 0.04); }
  .lp-filters::-webkit-scrollbar, .lp-table-wrap::-webkit-scrollbar, .palette-body::-webkit-scrollbar, .layers-box::-webkit-scrollbar, .command-history::-webkit-scrollbar, .suggest::-webkit-scrollbar, .tw-body::-webkit-scrollbar, #mtBody::-webkit-scrollbar, .mt-tools::-webkit-scrollbar, .rp-list::-webkit-scrollbar, .opt-pages::-webkit-scrollbar, .dim-pages::-webkit-scrollbar, #osList::-webkit-scrollbar, .help-main::-webkit-scrollbar, #helpList::-webkit-scrollbar, .drive-list::-webkit-scrollbar { width: 15px; height: 15px; }
  .lp-filters::-webkit-scrollbar-track, .lp-table-wrap::-webkit-scrollbar-track, .palette-body::-webkit-scrollbar-track, .layers-box::-webkit-scrollbar-track, .command-history::-webkit-scrollbar-track, .suggest::-webkit-scrollbar-track, .tw-body::-webkit-scrollbar-track, #mtBody::-webkit-scrollbar-track, .mt-tools::-webkit-scrollbar-track, .rp-list::-webkit-scrollbar-track, .opt-pages::-webkit-scrollbar-track, .dim-pages::-webkit-scrollbar-track, #osList::-webkit-scrollbar-track, .help-main::-webkit-scrollbar-track, #helpList::-webkit-scrollbar-track, .drive-list::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); }
  .lp-filters::-webkit-scrollbar-thumb, .lp-table-wrap::-webkit-scrollbar-thumb, .palette-body::-webkit-scrollbar-thumb, .layers-box::-webkit-scrollbar-thumb, .command-history::-webkit-scrollbar-thumb, .suggest::-webkit-scrollbar-thumb, .tw-body::-webkit-scrollbar-thumb, #mtBody::-webkit-scrollbar-thumb, .mt-tools::-webkit-scrollbar-thumb, .rp-list::-webkit-scrollbar-thumb, .opt-pages::-webkit-scrollbar-thumb, .dim-pages::-webkit-scrollbar-thumb, #osList::-webkit-scrollbar-thumb, .help-main::-webkit-scrollbar-thumb, #helpList::-webkit-scrollbar-thumb, .drive-list::-webkit-scrollbar-thumb { background: rgba(110, 160, 210, 0.55); border-radius: 7px; border: 2px solid rgba(0, 0, 0, 0.25); }
  .lp-filters::-webkit-scrollbar-thumb:hover, .lp-table-wrap::-webkit-scrollbar-thumb:hover, .palette-body::-webkit-scrollbar-thumb:hover, .layers-box::-webkit-scrollbar-thumb:hover, .command-history::-webkit-scrollbar-thumb:hover, .suggest::-webkit-scrollbar-thumb:hover, .tw-body::-webkit-scrollbar-thumb:hover, #mtBody::-webkit-scrollbar-thumb:hover, .mt-tools::-webkit-scrollbar-thumb:hover, .rp-list::-webkit-scrollbar-thumb:hover, .opt-pages::-webkit-scrollbar-thumb:hover, .dim-pages::-webkit-scrollbar-thumb:hover, #osList::-webkit-scrollbar-thumb:hover, .help-main::-webkit-scrollbar-thumb:hover, #helpList::-webkit-scrollbar-thumb:hover, .drive-list::-webkit-scrollbar-thumb:hover { background: rgba(110, 160, 210, 0.9); }
  body[data-theme="light"] .lp-filters, body[data-theme="light"] .lp-table-wrap, body[data-theme="light"] .palette-body, body[data-theme="light"] .layers-box, body[data-theme="light"] .command-history, body[data-theme="light"] .suggest, body[data-theme="light"] .tw-body, body[data-theme="light"] #mtBody, body[data-theme="light"] .mt-tools, body[data-theme="light"] .rp-list, body[data-theme="light"] .opt-pages, body[data-theme="light"] .dim-pages, body[data-theme="light"] #osList, body[data-theme="light"] .help-main, body[data-theme="light"] #helpList, body[data-theme="light"] .drive-list { scrollbar-color: rgba(70, 110, 85, 0.65) rgba(0, 0, 0, 0.06); }
  body[data-theme="light"] .lp-filters::-webkit-scrollbar-track, body[data-theme="light"] .lp-table-wrap::-webkit-scrollbar-track, body[data-theme="light"] .palette-body::-webkit-scrollbar-track, body[data-theme="light"] .layers-box::-webkit-scrollbar-track, body[data-theme="light"] .command-history::-webkit-scrollbar-track, body[data-theme="light"] .suggest::-webkit-scrollbar-track, body[data-theme="light"] .tw-body::-webkit-scrollbar-track, body[data-theme="light"] #mtBody::-webkit-scrollbar-track, body[data-theme="light"] .mt-tools::-webkit-scrollbar-track, body[data-theme="light"] .rp-list::-webkit-scrollbar-track, body[data-theme="light"] .opt-pages::-webkit-scrollbar-track, body[data-theme="light"] .dim-pages::-webkit-scrollbar-track, body[data-theme="light"] #osList::-webkit-scrollbar-track, body[data-theme="light"] .help-main::-webkit-scrollbar-track, body[data-theme="light"] #helpList::-webkit-scrollbar-track, body[data-theme="light"] .drive-list::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.06); }
  body[data-theme="light"] .lp-filters::-webkit-scrollbar-thumb, body[data-theme="light"] .lp-table-wrap::-webkit-scrollbar-thumb, body[data-theme="light"] .palette-body::-webkit-scrollbar-thumb, body[data-theme="light"] .layers-box::-webkit-scrollbar-thumb, body[data-theme="light"] .command-history::-webkit-scrollbar-thumb, body[data-theme="light"] .suggest::-webkit-scrollbar-thumb, body[data-theme="light"] .tw-body::-webkit-scrollbar-thumb, body[data-theme="light"] #mtBody::-webkit-scrollbar-thumb, body[data-theme="light"] .mt-tools::-webkit-scrollbar-thumb, body[data-theme="light"] .rp-list::-webkit-scrollbar-thumb, body[data-theme="light"] .opt-pages::-webkit-scrollbar-thumb, body[data-theme="light"] .dim-pages::-webkit-scrollbar-thumb, body[data-theme="light"] #osList::-webkit-scrollbar-thumb, body[data-theme="light"] .help-main::-webkit-scrollbar-thumb, body[data-theme="light"] #helpList::-webkit-scrollbar-thumb, body[data-theme="light"] .drive-list::-webkit-scrollbar-thumb { background: rgba(70, 110, 85, 0.65); border-color: rgba(255, 255, 255, 0.4); }
  body[data-theme="light"] .lp-filters::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .lp-table-wrap::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .palette-body::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .layers-box::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .command-history::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .suggest::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .tw-body::-webkit-scrollbar-thumb:hover, body[data-theme="light"] #mtBody::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .mt-tools::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .rp-list::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .opt-pages::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .dim-pages::-webkit-scrollbar-thumb:hover, body[data-theme="light"] #osList::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .help-main::-webkit-scrollbar-thumb:hover, body[data-theme="light"] #helpList::-webkit-scrollbar-thumb:hover, body[data-theme="light"] .drive-list::-webkit-scrollbar-thumb:hover { background: rgba(70, 110, 85, 0.95); }
  /* Themed scrollbars (V0.9.3): the SnakeScale Notes
     behavior. Thin bars, invisible at rest, fading in
     on hover of the scroll region. Every selector in a
     pseudo-element list must carry the pseudo itself;
     a plain selector in the list would take the sizing
     as its own element rule. */
  /* The shared panel pattern is carried by the one rule set above
     (V0.84.36): every selector there is a panel scroll area. */

  .kv > input.prop-in, .kv > select.prop-in, .kv > .prop-flex { flex: 1; min-width: 0; }
  .prop-in { width: 100%; box-sizing: border-box; background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 2px 5px; font: inherit; }
  .prop-flex { display: flex; gap: 4px; align-items: center; }
  .prop-colorpick { width: 26px; height: 22px; padding: 0; border: 1px solid #3a4a5a; border-radius: 3px; background: #10151c; cursor: pointer; flex: 0 0 auto; }
  .prop-btn { background: #1d2835; color: #d7e3ee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 3px 8px; cursor: pointer; flex: 1; }
  .prop-btn:hover { background: #2d4a67; }
  #annoDialog input[type="text"] { width: 100%; box-sizing: border-box; background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 4px 6px; }
  /* Quick Select and Annotative Object Scale dialogs (V0.57.0) */
  #qselectDialog select, #qselectDialog input[type="text"] { background: #10151c; color: #eeeeee; border: 1px solid #3a4a5a; border-radius: 3px; padding: 4px 6px; box-sizing: border-box; }
  .qs-lab { display: inline-block; min-width: 84px; }
  .qs-row { display: flex; gap: 6px; align-items: center; margin: 5px 0; }
  .qs-row .qs-prop { flex: 0 0 128px; }
  .qs-row .qs-op { flex: 0 0 104px; }
  .qs-row .qs-val { flex: 1; display: flex; min-width: 0; }
  .qs-row .qs-val > * { flex: 1; width: 100%; min-width: 0; }
  #osList { max-height: 260px; overflow-y: auto; margin: 6px 0; }
  .esl-cols { display: flex; gap: 14px; margin-top: 4px; }
  .esl-left { flex: 1; min-width: 0; }
  .esl-left label { display: block; margin-bottom: 4px; }
  .esl-left select { width: 100%; box-sizing: border-box; }
  .esl-btns { display: flex; flex-direction: column; gap: 6px; width: 112px; flex: none; }
  .esl-btns .mbtn { width: 100%; }
  #scaleListEquiv { margin-top: 6px; }
  .os-row { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #dddddd; padding: 3px 2px; cursor: pointer; }
  .units-note { color: #9fb4c6; font-size: 12px; margin: 8px 0; }
  .units-rescale { border: 1px solid #3a4a5a; border-radius: 4px; padding: 8px 10px; margin: 10px 0; }
  .units-rescale label { display: block; margin: 4px 0; }
  .coords { font-family: Consolas, "Courier New", monospace; color: #eeeeee; white-space: nowrap; }
  .status-buttons { display: flex; align-items: center; gap: 4px; overflow: hidden; }
  .sbtn {
    height: 21px; min-width: 42px; padding: 3px 7px; text-align: center; background: #242424;
    border: 1px solid #3d3d3d; color: #bbbbbb; border-radius: 3px; white-space: nowrap;
  }
  .sbtn:hover { border-color: #57a773; }
  .sbtn.on { color: #ffffff; border-color: #57a773; background: #20392b; }
  .status-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; white-space: nowrap; color: #bbbbbb; }
  .scale-box { border: 1px solid #3d3d3d; background: #222222; padding: 3px 8px; color: #ffffff; }

  /* Light theme (V0.11.4): chrome overrides under
     body[data-theme="light"]. The dark theme is the
     base stylesheet; these rules restyle the shell,
     panels, dialogs, and command area. */
  body[data-theme="light"] { background: #e6e6e6; color: #1c1c1c; }
  body[data-theme="light"] .titlebar { background: #f0f0f0; border-bottom-color: #c9c9c9; }
  body[data-theme="light"] .qbtn { background: #ffffff; border-color: #c4c4c4; color: #222222; }
  body[data-theme="light"] .qbtn:hover { background: #eef6f1; }
  body[data-theme="light"] .ribbon { background: #e4e4e4; border-bottom-color: #c9c9c9; }
  body[data-theme="light"] .ribbon-tabs { border-bottom-color: #c9c9c9; }
  body[data-theme="light"] .rtab { color: #444444; }
  body[data-theme="light"] .rtab.active { background: #ffffff; color: #111111; }
  body[data-theme="light"] .panel-title { color: #555555; }
  body[data-theme="light"] .tool { background: #f7f7f7; border-color: #c4c4c4; color: #1c1c1c; }
  body[data-theme="light"] .tool .glyph { color: #1c1c1c; }
  body[data-theme="light"] .tool .label { color: #444444; }
  body[data-theme="light"] .tool:hover { background: #dcefe2; }
  body[data-theme="light"] .tool.active { background: #cfe6d6; }
  body[data-theme="light"] .file-tabs { background: #dedede; border-bottom-color: #c9c9c9; }
  body[data-theme="light"] .ftab { background: #ececec; color: #333333; border-color: #c4c4c4; }
  body[data-theme="light"] .ftab.active { background: #ffffff; color: #111111; }
  body[data-theme="light"] .ftab .ftab-x:hover { background: rgba(0, 0, 0, .1); }
  body[data-theme="light"] .ltab { background: #2c2c2c; color: #9a9a9a; border-color: #3d3d3d; }
  body[data-theme="light"] .ltab.active { background: #0d0d0d; color: #ffffff; }
  body[data-theme="light"] .dock { background: #e4e4e4; }
  body[data-theme="light"] #dockLeft { border-right-color: #c9c9c9; }
  body[data-theme="light"] #dockRight { border-left-color: #c9c9c9; }
  body[data-theme="light"] .tb { background: #f2f2f2; border-color: #c4c4c4; }
  body[data-theme="light"] .tb-grip { background: #e0e0e0; color: #555555; }
  body[data-theme="light"] .tb-btn { border-color: #c4c4c4; color: #1c1c1c; }
  body[data-theme="light"] .tb-btn:hover { background: #cfe0f2; }
  body[data-theme="light"] .tb-x { color: #666666; }
  body[data-theme="light"] .tb-x:hover { color: #111111; }
  body[data-theme="light"] .tb-menu { background: #f5f5f5; border-color: #c4c4c4; }
  body[data-theme="light"] .tb-menu-row { color: #222222; }
  body[data-theme="light"] .tb-menu-row:hover { background: #cfe0f2; }
  body[data-theme="light"] .tb-menu-sect { color: #777777; }
  body[data-theme="light"] .tb-menu-btn { background: #f7f7f7; border-color: #c4c4c4; color: #1c1c1c; }
  body[data-theme="light"] .palette { background: #f2f2f2; border-left-color: #c9c9c9; }
  body[data-theme="light"] .palette-header { background: #e4e4e4; }
  body[data-theme="light"] .dock-panel { color: #1c1c1c; }
  body[data-theme="light"] .layers-box { border-top-color: #c9c9c9; }
  body[data-theme="light"] .lp-current { color: #444444; border-bottom-color: #c9c9c9; }
  body[data-theme="light"] .lp-tool { border-color: #c4c4c4; color: #1c1c1c; }
  body[data-theme="light"] .lp-tool:hover { background: #cfe0f2; }
  body[data-theme="light"] .lp-fnode { color: #333333; }
  body[data-theme="light"] .lp-fnode:hover { background: #e2e2e2; }
  body[data-theme="light"] .lp-fnode.on { background: #cfe0f2; color: #111111; }
  body[data-theme="light"] .lp-fnode.child { color: #777777; }
  body[data-theme="light"] .lp-table th { background: #e8e8e8; color: #333333; }
  body[data-theme="light"] .lp-table td { color: #1c1c1c; border-bottom-color: #dddddd; }
  body[data-theme="light"] .lp-table tr.sel td { background: #cfe0f2; }
  body[data-theme="light"] .lp-desc, body[data-theme="light"] .lp-rename { color: #1c1c1c; }
  body[data-theme="light"] .lp-dim, body[data-theme="light"] .lp-empty { color: #777777; }
  body[data-theme="light"] .command-area { background: #f0f0f0; }
  body[data-theme="light"] .cmd-suggest-pop { background: #ffffff; border-color: #b9c4cf; box-shadow: 0 6px 18px rgba(30,50,40,0.25); }
  body[data-theme="light"] .cmd-suggest-pop .suggest-item { color: #222222; }
  body[data-theme="light"] .cmd-suggest-pop .suggest-item.active { background: #dcefe2; color: #111111; }
  body[data-theme="light"] .command-history { color: #262626; }
  body[data-theme="light"] .command-history .cmd { color: #111111; }
  body[data-theme="light"] .command-history .dim { color: #777777; }
  body[data-theme="light"] .command-history .err { color: #b03030; }
  body[data-theme="light"] .command-history .note { color: #1a5fb4; }
  body[data-theme="light"] .command-input-row .prompt { color: #1d6f42; }
  body[data-theme="light"] #cmdInput { background: #ffffff; color: #111111; border-color: #57a773; }
  body[data-theme="light"] .suggest { background: #ffffff; color: #1c1c1c; border-left-color: #c9c9c9; }
  body[data-theme="light"] .statusbar { background: #e4e4e4; border-top-color: #c9c9c9; color: #333333; }
  body[data-theme="light"] .sbtn { background: #f7f7f7; border-color: #c4c4c4; color: #333333; }
  body[data-theme="light"] .sbtn.on { background: #cfe6d6; border-color: #57a773; color: #111111; }
  body[data-theme="light"] .status-right { color: #444444; }
  body[data-theme="light"] .modal-card { background: #f5f5f5; border-color: #c4c4c4; color: #1c1c1c; }
  body[data-theme="light"] .modal-title { color: #111111; }
  body[data-theme="light"] .mbtn { background: #ffffff; border-color: #c4c4c4; color: #1c1c1c; }
  body[data-theme="light"] .mbtn:hover { background: #ececec; }
  body[data-theme="light"] .mbtn.primary { background: #244434; border-color: #57a773; color: #ffffff; }
  body[data-theme="light"] .dxf-prog-track { background: #ffffff; border-color: #b9c4cf; }
  body[data-theme="light"] .ins-input, body[data-theme="light"] .set-row input, body[data-theme="light"] .set-row select,
  body[data-theme="light"] .ins-xy input, body[data-theme="light"] .ins-pick-row select, body[data-theme="light"] .alias-row input,
  body[data-theme="light"] .mt-tools input[type="text"], body[data-theme="light"] .mt-tools select,
  body[data-theme="light"] .lp-sel, body[data-theme="light"] .tb-layer-sel, body[data-theme="light"] .layer-select,
  body[data-theme="light"] #styleDialog input[type="text"], body[data-theme="light"] #annoDialog input[type="text"] { background: #ffffff; color: #1c1c1c; border-color: #b9c4cf; }
  body[data-theme="light"] .modal-card input:disabled, body[data-theme="light"] .modal-card select:disabled, body[data-theme="light"] .modal-card textarea:disabled,
  body[data-theme="light"] .ins-input:disabled { background: #e6e6e6; color: #9c9c9c; border-color: #c9c9c9; }
  body[data-theme="light"] #qselectDialog select, body[data-theme="light"] #qselectDialog input[type="text"] { background: #ffffff; color: #1c1c1c; border-color: #b9c4cf; }
  body[data-theme="light"] .os-row { color: #1c1c1c; }
  body[data-theme="light"] .ins-sub, body[data-theme="light"] .ins-group legend { color: #666666; }
  body[data-theme="light"] .ins-pick-row, body[data-theme="light"] .ins-chk, body[data-theme="light"] .ins-xy label { color: #333333; }
  body[data-theme="light"] .set-row { color: #1c1c1c; }
  body[data-theme="light"] .opt-head { color: #666666; }
  body[data-theme="light"] .ssc-tabs { border-bottom-color: #c4c4c4; }
  body[data-theme="light"] .ssc-tab { background: #ececec; color: #555555; border-color: #c4c4c4; }
  body[data-theme="light"] .ssc-tab:hover { background: #f7f7f7; color: #111111; }
  body[data-theme="light"] .ssc-tab.active { background: #f5f5f5; color: #111111; }
  body[data-theme="light"] .ssc-pages { border-color: #c4c4c4; }
  body[data-theme="light"] .ssc-pagebox { border-color: #c4c4c4; }
  body[data-theme="light"] .opt-group { border-color: #c4c4c4; }
  body[data-theme="light"] .opt-group legend { color: #666666; }
  body[data-theme="light"] .opt-row { color: #1c1c1c; }
  body[data-theme="light"] .opt-row select, body[data-theme="light"] .opt-row input[type="number"] { background: #ffffff; color: #1c1c1c; border-color: #b9c4cf; }
  body[data-theme="light"] .opt-note { color: #666666; }
  body[data-theme="light"] .opt-unit { color: #666666; }
  body[data-theme="light"] .opt-preview { border-color: #c4c4c4; }
  body[data-theme="light"] .lock-card { background: #f5f5f5; border-color: #c4c4c4; color: #1c1c1c; }
  body[data-theme="light"] .lock-card input { background: #ffffff; border-color: #c4c4c4; color: #111111; }
  body[data-theme="light"] .tw-body { background: #f7f7f7; color: #1c1c1c; }
  body[data-theme="light"] .tw-body .cmd { color: #1d6f42; }
  body[data-theme="light"] .tw-body .err { color: #b03030; }
  body[data-theme="light"] .tw-body .note { color: #1a5fb4; }
  body[data-theme="light"] #mtextEditor { background: #f2f2f2; border-color: #b9c4cf; }
  body[data-theme="light"] #mtBody { background: rgba(255, 255, 255, 0.95); color: #111111; border-color: #8a8a8a; }
  body[data-theme="light"] .dyn-input { background: rgba(255, 255, 255, 0.94); color: #111111; }
  body[data-theme="light"] .dyn-input .dyn-title { color: #1d6f42; }
  body[data-theme="light"] .ins-thumb-big { background: #ffffff; border-color: #c4c4c4; }
  body[data-theme="light"] #cellEditor { background: #ffffff; color: #111111; }

  /* Help window (V0.11.5) */
  .help-wrap { display: flex; gap: 14px; flex: 1; min-height: 0; margin-top: 6px; }
  .help-side { width: 238px; flex: 0 0 auto; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
  #helpList { overflow-y: auto; flex: 1; min-height: 0; }
  .help-item { padding: 5px 8px; cursor: pointer; border-radius: 4px; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .help-item:hover { background: #333333; }
  .help-item.on { background: #2d4a67; color: #ffffff; }
  .help-main { flex: 1; overflow-y: auto; min-width: 0; padding-right: 4px; }
  #helpTopicTitle { font-size: 16px; font-weight: bold; }
  .help-meta { color: #9a9a9a; font-size: 11.5px; margin: 2px 0 8px; }
  #helpBody { font-size: 12.5px; line-height: 1.55; }
  #helpBody p { margin: 0 0 8px; }
  #helpBody ol, #helpBody ul { margin: 0 0 8px 18px; padding: 0; }
  #helpBody li { margin-bottom: 3px; }
  body[data-theme="light"] .help-item:hover { background: #e2e2e2; }
  body[data-theme="light"] .help-item.on { background: #cfe0f2; color: #111111; }
  body[data-theme="light"] .help-meta { color: #666666; }
.ml-cols{display:flex;gap:14px;align-items:flex-start}
.ml-col-btns{display:flex;flex-direction:column;gap:6px}
.ml-col-btns .mbtn{width:112px}
.ml-fields{flex:1;min-width:0}
.ml-preview{background:#000;border:1px solid #2c3947;border-radius:4px}
.ml-group{border:1px solid #2c3947;border-radius:4px;margin:0 0 10px;padding:8px 10px}
.ml-group legend{padding:0 4px;color:#9fb4c8;font-size:12px}
#helpDialog{z-index:7100}
.help-panel{position:fixed;top:52px;right:18px;width:900px;max-width:96vw;height:78vh;flex-direction:column}
.help-panel .modal-title{cursor:move;user-select:none}
/* Themed scrollbars everywhere (V0.11.8, Chris's standing rule: ALL controls themed). Any scroll region without its own rules gets these: thin bars, invisible at rest, steel blue on hover, in both themes. */
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:rgba(110,160,210,.45);border-radius:5px}
::-webkit-scrollbar-thumb:hover{background:rgba(110,160,210,.75)}
body[data-theme="light"] ::-webkit-scrollbar-thumb{background:rgba(70,110,85,.5)}
body[data-theme="light"] ::-webkit-scrollbar-thumb:hover{background:rgba(70,110,85,.8)}
/* Themed native controls: checkboxes and radios take the app accent in both themes. */
input[type="checkbox"],input[type="radio"]{accent-color:#57a773}
/* Light theme ribbon tools and panel pins (the icons that did not update). */
body[data-theme="light"] .tool{background:#e9eff5;border-color:#b7c8d8;color:#22384e}
body[data-theme="light"] .tool:hover{background:#dcecdf;border-color:#57a773}
body[data-theme="light"] .tool .glyph{color:#22384e}
body[data-theme="light"] .tool .label{color:#22384e}
body[data-theme="light"] .pal-pin,body[data-theme="light"] .pal-close{color:#5a7186}
/* MLEADER dialogs: breathing room (V0.11.8). */
.dim-card{width:720px;max-width:94vw}
#dimstyleDialog .ins-row,#dimModDialog .ins-row,#dimNewDialog .ins-row{margin:0 0 9px;min-height:26px;align-items:center}
#dimstyleDialog .ml-cols{gap:18px}
#dimModDialog .modal-btns,#dimstyleDialog .modal-btns,#dimNewDialog .modal-btns{margin-top:14px}
#dimModDialog select.ins-input,#dimModDialog input.ins-input{padding:3px 6px}
#dimModDialog input[type="checkbox"]{width:15px;height:15px}
.dim-mod-prev{width:100%;height:96px;margin:2px 0 10px}
.dim-pages{max-height:46vh;overflow-y:auto;padding-right:6px}
.dim-page{display:none}
.dim-page.active{display:block}
.dim-group{border:1px solid var(--line,#3a3a3a);border-radius:8px;padding:12px 14px 6px;margin:0 0 14px}
.dim-group-title{font-weight:600;margin:0 0 10px}
.dim-group .ins-row>span:first-child{min-width:210px}
#mlModifyDialog .ins-row,#mlstyleDialog .ins-row{margin:0 0 9px;min-height:26px;align-items:center}
/* Table Style dialog (V0.68.0, Chris): the same row
   rhythm and group padding as the dimension and
   multileader dialogs; its rows stacked flush before.
   V0.70.0: the rule follows the rebuild, so the
   manager, the editor, the name dialog, and the
   Insert Table dialog all keep the same rhythm. */
#tablestyleDialog .ins-row,#tsEditDialog .ins-row,#tsNewDialog .ins-row,#tableDialog .ins-row{margin:0 0 9px;min-height:26px;align-items:center}
#tablestyleDialog .ml-group,#tsEditDialog .ml-group,#tableDialog .ml-group{padding:12px 14px 14px;margin:0 0 14px}
#tsEditDialog .ml-cols,#tablestyleDialog .ml-cols,#tableDialog .ml-cols{gap:18px}
#tsEditDialog .modal-btns,#tablestyleDialog .modal-btns{margin-top:14px}
#mlModifyDialog .ml-group{padding:12px 14px 14px;margin:0 0 14px}
#mlModifyDialog .ml-cols,#mlstyleDialog .ml-cols{gap:18px}
#mlModifyDialog .modal-btns,#mlstyleDialog .modal-btns{margin-top:14px}
#mlModifyDialog .ins-sub{margin:4px 0 8px;line-height:1.45}
#mlModifyDialog select.ins-input,#mlModifyDialog input.ins-input{padding:3px 6px}
#mlModifyDialog input[type="checkbox"],#mlModifyDialog input[type="radio"]{width:15px;height:15px}
#mlstyleDialog select.ins-input{padding:3px 6px}
#mlMgrCurrent{margin:2px 0 10px}
#mlNewDialog .ins-row{margin:0 0 10px}
/* Theming completion (V0.11.9, Chris's standing rule: ALL controls themed). color-scheme makes every native surface Edge paints (dropdown lists, native scrollbars, form internals) follow the active theme. */
:root{color-scheme:dark}
body[data-theme="light"]{color-scheme:light}
/* Catch-all control theming: a select, textarea, or text input with no class rule of its own still lands themed in both themes. Class rules outrank these element rules wherever they exist. */
select{background:#242424;color:#e8e8e8;border:1px solid #4a4a4a;border-radius:3px}
textarea{background:#242424;color:#e8e8e8;border:1px solid #4a4a4a;border-radius:3px}
input[type="text"],input[type="number"]{border-radius:3px}
body[data-theme="light"] select{background:#ffffff;color:#1c1c1c;border-color:#b9c4cf}
body[data-theme="light"] textarea{background:#ffffff;color:#1c1c1c;border-color:#b9c4cf}
/* The floating toolbar buttons: the light rule recolored border and text but never the background, so the buttons stayed dark. */
body[data-theme="light"] .tb-btn{background:#e9eff5;border-color:#b7c8d8;color:#22384e}
/* The ribbon Layers mini buttons had no light rule at all. */
body[data-theme="light"] .mini-btn{background:#e9eff5;border-color:#b7c8d8;color:#22384e}
body[data-theme="light"] .mini-btn:hover{background:#dcecdf;border-color:#57a773}
body[data-theme="light"] .clickable:hover{color:#14529e}
/* Label padding (V0.11.9): dialog rows are flex rows with a real gap, and the description label never sits flush against its control or the group edge. */
.ins-row{display:flex;align-items:center;gap:10px}
.ins-row>span:first-child{padding-left:6px}
.ins-row>span:last-child{flex:1;min-width:0}
/* Light contrast pass (V0.11.10): muted text families that were tuned for dark backgrounds get readable values, and the Properties inputs join the themed set. */
body[data-theme="light"] .kv{color:#40536a}
body[data-theme="light"] .kv .value{background:#e9eff5;color:#1c1c1c;border-color:#b9c4cf}
body[data-theme="light"] .prop-in{background:#ffffff;color:#1c1c1c;border-color:#b9c4cf}
body[data-theme="light"] .prop-colorpick{background:#ffffff;border-color:#b9c4cf}
body[data-theme="light"] .prop-btn{background:#e9eff5;color:#22384e;border-color:#b7c8d8}
body[data-theme="light"] .section-title{color:#2e7d4f}
body[data-theme="light"] .panel-title{color:#3f5468}
body[data-theme="light"] .prop-row{color:#40536a}
body[data-theme="light"] .prop-row .clickable:hover{color:#14529e}
body[data-theme="light"] .ml-group legend{color:#40536a}
/* Full audit pass (V0.11.11): every remaining chrome family from the static audit gets its light value. Canvas overlays (snap menu, nav buttons, viewcube, layout tabs, text editors) stay dark by design because they float on the black drawing area; the lock screen keeps its brand look. */
/* Ribbon in every display mode */
body[data-theme="light"] .ribbon-mode{background:#e9eff5;color:#22384e;border-color:#b7c8d8}
body[data-theme="light"] #ribbonHandle{background:#e9eff5;color:#22384e;border-color:#b7c8d8}
body[data-theme="light"][data-ribbonmode="tabs"] .ribbon.pop .ribbon-body{background:#f2f2f2;box-shadow:0 6px 18px rgba(30,50,70,.18)}
body[data-theme="light"] .rtitle{background:#e8e8e8;color:#3a4a58;border-color:#b9c2ca}
body[data-theme="light"] .rtitle:hover{border-color:#57a773;color:#14301f}
body[data-theme="light"] .rtitle.active{background:#cfe6d8;color:#14301f;border-color:#57a773}
body[data-theme="light"] .ribbon-pop{background:#f2f2f2;border-color:#b9c2ca;box-shadow:0 6px 18px rgba(30,50,70,.18)}
body[data-theme="light"].mt-editing[data-ribbonmode="tabs"] .ribbon.pop #mtCtxBody{background:#f2f2f2;box-shadow:0 6px 18px rgba(30,50,70,.18)}
body[data-theme="light"] .rtab.ctx{color:#1d5c38}
/* Shell text */
body[data-theme="light"] .app{background:#e6e6e6}
body[data-theme="light"] .coords{color:#40536a}
body[data-theme="light"] .drawing-title{color:#40536a}
body[data-theme="light"] .title-right{color:#40536a}
body[data-theme="light"] .sbtn:hover{background:#dcecdf}
body[data-theme="light"] .tb-menu-btn:hover{color:#22384e}
/* Command suggestions */
body[data-theme="light"] .suggest-item{color:#22384e}
body[data-theme="light"] .suggest-title{color:#5a6a78}
/* Layers list rows */
body[data-theme="light"] .layer-line{color:#22384e}
body[data-theme="light"] .layer-line:hover{background:#dcecdf}
body[data-theme="light"] .layer-line.current{background:#cfe6d4}
body[data-theme="light"] .layer-state:hover{background:#dcecdf}
body[data-theme="light"] .layers-add{color:#2e7d4f}
body[data-theme="light"] .layers-panel{background:#f0f0f0}
body[data-theme="light"] .lp-desc:focus{background:#ffffff}
/* Dialog text families */
body[data-theme="light"] .alias-row .alias-cmd{color:#22384e}
body[data-theme="light"] .alias-cat{color:#33506e}
body[data-theme="light"] .tpl-table td.tpl-name{color:#22384e}
body[data-theme="light"] .pg-kept-row{color:#40536a}
body[data-theme="light"] .pg-row{color:#22384e}
body[data-theme="light"] .purge-group{color:#40536a}
body[data-theme="light"] .purge-pane-title{color:#22384e}
body[data-theme="light"] .osnap-row:hover{background:#dcecdf}
body[data-theme="light"] .set-row{color:#40536a}
body[data-theme="light"] .set-row input[type="number"]{background:#ffffff;color:#1c1c1c;border-color:#b9c4cf}
body[data-theme="light"] .style-preview{color:#1c1c1c}
body[data-theme="light"] .units-group legend{color:#40536a}
body[data-theme="light"] .units-note{color:#55606a}
body[data-theme="light"] .units-sample{color:#1c1c1c}
body[data-theme="light"] .scale-box{background:#e9eff5;color:#1c1c1c;border-color:#b9c4cf}
body[data-theme="light"] .kv .value.green{color:#2e7d4f}
body[data-theme="light"] .prop-btn:hover{background:#cfe0f2}
/* MTEXT editor toolbar (the editor card itself is themed) */
body[data-theme="light"] .mtb{background:#e9eff5;color:#22384e;border-color:#b7c8d8}
body[data-theme="light"] .mtb:hover{background:#cfe0f2}
/* Text window */
body[data-theme="light"] .ml-group{border-color:#c3cedb}
body[data-theme="light"] .ml-group legend{color:#44586e}

/* References panel (V0.14.0), modeled on the reference package External References palette. */
/* The References root paints its own surface
   (V0.73.5): every other panel root carries the
   shared panel background (Properties and Layers
   #262626, Command Line #141414); this one never
   did, so any state that takes the element off
   its dock host, the auto hide overlay above
   all, showed the drawing through its list body.
   The root is also the flex column its body
   wrapper expects, so the list fills and the
   footer anchors in every state, not just
   afloat, and overflow hidden is the containment
   backstop: no descendant paints outside the
   panel box. The V0.73.4 float rule stays as the
   float state's own guarantee for the panels
   whose roots differ (Command Line); References
   no longer depends on it. */
body .dock-panel.status-panel { position: relative; display: flex; flex-direction: column; min-height: 0; background: #141414; overflow: hidden; } /* Stage 2c (defect D2): the strengthened selector (0-2-1) beats .dock-panel.tb-float (0-2-0), so the root stays #141414 in the floating, detached, and pinned postures that keep the tb-float class; light is unchanged (the light status rule ties at 0-2-1 and is later, the light float rule wins at 0-3-1, both #f0f0f0) */
.refs-panel{position:relative;display:flex;flex-direction:column;min-height:0;background:#262626;overflow:hidden}
.rp-tools{display:flex;gap:6px;align-items:center;padding:6px 8px;border-bottom:1px solid #333333}
.rp-menu{position:absolute;top:72px;left:8px;z-index:40;background:#232c38;border:1px solid #41505f;border-radius:4px;min-width:200px;box-shadow:0 8px 20px rgba(0,0,0,.45);padding:3px}
.rp-menu-item{padding:5px 9px;font-size:12.5px;color:#d7e3ee;border-radius:3px;cursor:pointer}
.rp-menu-item:hover{background:#31435a}
.rp-head,.rp-row{display:grid;grid-template-columns:minmax(104px,1.3fr) 72px 60px 70px 112px minmax(110px,1.5fr);gap:8px;padding:4px 8px;font-size:11.5px;align-items:center}
.rp-head{color:#8fa5ba;border-bottom:1px solid #333333;font-size:11px;position:sticky;top:0;z-index:2;background:#262626}
/* One scroll view (V0.73.5): #rpList scrolls on
   both axes around .rp-inner, whose minimum
   width is the columns' minimum total (104 + 72
   + 60 + 70 + 112 + 110 of column minimums, five
   8px gaps, 16px of row padding: 584). Header
   and rows share one grid inside it and stay
   aligned at every scroll offset; above the
   minimum the inner stretches with the view and
   nothing scrolls horizontally. Rows are built
   into #rpRows; #rpList itself is never
   cleared. */
.rp-list{overflow:auto;min-height:60px;flex:1}
.rp-inner{min-width:584px}
.rp-row{color:#cfd8e0;cursor:pointer;border-bottom:1px solid #262d36}
.rp-row:hover{background:#26313f}
.rp-row.sel{background:#2e4a68;color:#ffffff}
.rp-row .rp-st-bad{color:#e08a8a}
.rp-actions{display:flex;gap:6px;flex-wrap:wrap;padding:6px 8px;border-top:1px solid #333333;min-height:20px}
.rp-foot{padding:5px 8px;font-size:11px;color:#8fa5ba;border-top:1px solid #333333;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body[data-theme="light"] .rp-tools{border-color:#c3ced8}
body[data-theme="light"] .rp-menu{background:#ffffff;border-color:#b7c8d8}
body[data-theme="light"] .rp-menu-item{color:#22384e}
body[data-theme="light"] .rp-menu-item:hover{background:#e9eff5}
body[data-theme="light"] .refs-panel{background:#f0f0f0}
body[data-theme="light"] .status-panel { background: #f0f0f0; }
body[data-theme="light"] .rp-head{color:#40536a;border-color:#c3ced8;background:#f0f0f0}
body[data-theme="light"] .rp-row{color:#22384e;border-color:#d5dde5}
body[data-theme="light"] .rp-row:hover{background:#dde7f0}
body[data-theme="light"] .rp-row.sel{background:#bcd3ea;color:#10263c}
body[data-theme="light"] .rp-row .rp-st-bad{color:#b03a3a}
body[data-theme="light"] .rp-actions{border-color:#c3ced8}
body[data-theme="light"] .rp-foot{color:#40536a;border-color:#c3ced8}

/* Held cursor while any file dialog is open (V0.15.0): beats the canvas cursor:none and every other cursor rule until fileDialogDone releases it. */
html.dlg-cursor, html.dlg-cursor *{cursor:default !important}
/* The cursor shield (V0.34.1): a real, hit
   testable element parked under the pointer
   while a file dialog is armed, carrying the
   default cursor so the renderer's next cursor
   commit (which the dialog inherits) is a
   visible one even when the command was typed
   and the mouse never really moved. */
#dlgShield { position: fixed; width: 8px; height: 8px; margin: -4px 0 0 -4px; z-index: 9990; cursor: default; background: transparent; display: none; }

/* PDF Import dialog (rebuilt V0.34.0 to Chris's
   screenshot of the reference dialog): thumbnails on the
   left, settings groups on the right. */
.pdf-card { width: 880px; max-width: 96vw; max-height: 92vh; overflow-y: auto; }
.pdf-filerow { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.pdf-filerow span { font-size: 12px; color: #9fb2c3; padding-right: 2px; }
.pdf-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 16px; align-items: start; }
.pdf-thumbs { display: grid; grid-template-columns: repeat(auto-fill, 104px); gap: 10px; max-height: 342px; overflow-y: auto; padding: 6px 2px; }
.pdf-thumb { cursor: pointer; text-align: center; }
.pdf-thumb canvas { width: 104px; border: 2px solid #2c3947; border-radius: 3px; background: #ffffff; display: block; }
.pdf-thumb.sel canvas { border-color: #57a773; box-shadow: 0 0 0 1px #57a773; }
.pdf-thumb .pdf-tnum { font-size: 11px; color: #9fb2c3; padding-top: 2px; }
.pdf-foot { display: flex; justify-content: space-between; font-size: 11.5px; color: #9fb2c3; padding: 6px 2px 0; }
body[data-theme="light"] .pdf-thumb canvas { border-color: #b9c4cf; }
body[data-theme="light"] .pdf-thumb.sel canvas { border-color: #1d6f42; box-shadow: 0 0 0 1px #1d6f42; }
/* PDF Import dialog (V0.16.0). */
.pdf-file{font-size:12.5px;color:#cfd8e0;padding:2px 2px 8px}
.pdf-pages{max-height:240px;overflow-y:auto;border:1px solid #333333;border-radius:4px;padding:4px;margin-bottom:8px}
.pdf-page-row{display:flex;gap:8px;align-items:center;padding:4px 6px;font-size:12.5px;color:#d7e3ee}
.pdf-page-row:hover{background:#26313f}
body[data-theme="light"] .pdf-file{color:#22384e}
body[data-theme="light"] .pdf-pages{border-color:#c3ced8}
body[data-theme="light"] .pdf-page-row{color:#22384e}
body[data-theme="light"] .pdf-page-row:hover{background:#dde7f0}

/* ---- Modern surfaces (V0.35.9) ----
   Chris's look: more modern, like current
   the reference package. Smoother edges and rounded,
   better themed buttons instead of hard
   corners, the same treatment for every
   control, in BOTH themes. This block is
   corners, shadows, focus rings, and
   hover feel only: no sizes, no padding,
   no positions, and none of the base
   surface colors, so saved layouts, dock
   metrics, and the theme audit all stand
   exactly as they were. */
.mbtn { border-radius: 7px; background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.mbtn:hover { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); }
.mbtn:active { box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35); }
body[data-theme="light"] .mbtn { background-image: linear-gradient(rgba(255, 255, 255, 0.65), rgba(0, 0, 0, 0.03)); box-shadow: 0 1px 2px rgba(30, 40, 50, 0.18); }
.tool { border-radius: 7px; background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)); transition: border-color 0.12s ease; }
body[data-theme="light"] .tool { background-image: linear-gradient(rgba(255, 255, 255, 0.6), rgba(0, 0, 0, 0.03)); }
.tb-btn { border-radius: 7px; background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)); transition: border-color 0.12s ease; }
body[data-theme="light"] .tb-btn { background-image: linear-gradient(rgba(255, 255, 255, 0.6), rgba(0, 0, 0, 0.03)); }
.sbtn { border-radius: 6px; transition: border-color 0.12s ease; }
.tb-menu-btn { border-radius: 6px; }
.rtab { border-radius: 8px 8px 0 0; }
.ssc-tab { border-radius: 8px 8px 0 0; }
.modal-card { border-radius: 12px; }
  /* Select Color dialog (V0.83.12) */
  .cd-pages { border: 1px solid #3a3a3a; border-top: none; padding: 12px; }
  .cd-page { display: none; }
  .cd-page.active { display: block; }
  .cd-label { font-size: 12.5px; margin-bottom: 6px; }
  .cd-grid { display: grid; grid-template-columns: repeat(24, 1fr); gap: 1px; }
  .cd-grid-lo { margin-top: 8px; }
  .cd-sw { height: 11px; border: 1px solid rgba(0, 0, 0, 0.4); padding: 0; margin: 0; cursor: pointer; border-radius: 0; display: block; width: 100%; }
  .cd-sw:hover { outline: 1px solid #ffffff; outline-offset: -1px; }
  .cd-sw.sel { outline: 2px solid #57a773; outline-offset: -1px; position: relative; z-index: 1; }
  .cd-grid-sm { display: flex; gap: 1px; margin-top: 8px; }
  .cd-grid-sm .cd-sw { width: 26px; height: 16px; flex: none; }
  .cd-midrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
  .cd-sentinels { display: flex; gap: 8px; padding-top: 8px; }
  .cd-sentinels .mbtn.sel { background: #244434; border-color: #57a773; }
  .cd-bottom { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 14px; gap: 12px; }
  .cd-colorfield { flex: 1; }
  .cd-colorfield label { display: block; font-size: 12.5px; margin-bottom: 4px; }
  .cd-text { width: 100%; max-width: 240px; background: #141414; border: 1px solid #3a3a3a; color: #eeeeee; padding: 5px 7px; border-radius: 4px; font: inherit; font-size: 12.5px; }
  .cd-preview { width: 84px; height: 64px; flex: none; border: 1px solid #777777; clip-path: polygon(0 0, 100% 0, 100% 100%, 30% 100%, 30% 58%, 0 58%); }
  .cd-preview.sentinel { background: repeating-linear-gradient(45deg, #9a9a9a 0 6px, #5a5a5a 6px 12px); }
  .cd-titlerow { display: flex; justify-content: space-between; align-items: center; }
  .cd-x { height: 24px; padding: 0 8px; line-height: 1; }
  .cd-tc-top { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; align-items: flex-end; }
  .cd-numgrp label { display: block; font-size: 12px; margin-bottom: 3px; }
  .cd-num { width: 66px; background: #141414; border: 1px solid #3a3a3a; color: #eeeeee; padding: 4px 6px; border-radius: 4px; font: inherit; font-size: 12.5px; }
  .cd-model { background: #141414; border: 1px solid #3a3a3a; color: #eeeeee; padding: 4px 6px; border-radius: 4px; font: inherit; font-size: 12.5px; }
  .cd-tc-main { display: flex; gap: 12px; }
  .cd-fieldwrap { position: relative; width: 252px; height: 196px; flex: none; cursor: crosshair; }
  .cd-fieldwrap canvas { display: block; }
  .cd-marker { position: absolute; width: 11px; height: 11px; border: 2px solid #ffffff; box-shadow: 0 0 0 1px #000000; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; }
  .cd-lumwrap { flex: none; display: flex; flex-direction: column; gap: 4px; }
  .cd-curstrip { height: 10px; border: 1px solid #777777; }
  .cd-lum { position: relative; width: 22px; flex: 1; border: 1px solid #777777; cursor: pointer; }
  .cd-lummarker { position: absolute; left: -4px; right: -4px; height: 2px; background: #ffffff; box-shadow: 0 0 0 1px #000000; pointer-events: none; }
  .cd-readout { font-size: 12.5px; line-height: 1.55; padding-top: 2px; }
  .cd-ro { display: flex; justify-content: space-between; width: 96px; }
  .cd-pickbtn { width: 52px; height: 22px; padding: 0; border: 1px solid #3a4a5a; border-radius: 3px; cursor: pointer; vertical-align: middle; }
  .opt-color-btn { width: 64px; height: 22px; padding: 0; border: 1px solid #4a4a4a; border-radius: 4px; cursor: pointer; vertical-align: middle; }
  #mtColor { background: none; border: none; padding: 0; font: inherit; }
  body[data-theme="light"] .cd-pages { border-color: #c4c4c4; }
  body[data-theme="light"] .cd-text, body[data-theme="light"] .cd-num, body[data-theme="light"] .cd-model { background: #ffffff; border-color: #b9c4cf; color: #111111; }
  body[data-theme="light"] .cd-pickbtn { border-color: #b9c4cf; }
  body[data-theme="light"] .opt-color-btn { border-color: #b9c4cf; }

.lock-card { border-radius: 12px; }
.lock-card input, .lock-btn { border-radius: 7px; }
.patdraw-panel { border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.snap-menu { border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); overflow: hidden; }
.cmd-suggest-pop { border-radius: 10px; }
.cmd-suggest-pop .suggest-item, .suggest-item { border-radius: 5px; }
.pdf-pages { border-radius: 8px; }
.pdf-page-row { border-radius: 5px; }
body > .dock-panel { border-radius: 12px; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45); }
.ins-input, .layer-select, .scale-box, #cmdInput { border-radius: 6px; }
.ins-input { transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.ins-input:focus, .layer-select:focus { outline: none; border-color: #57a773; box-shadow: 0 0 0 3px rgba(87, 167, 115, 0.22); }
  /* Disabled dialog fields (V0.72.0): a disabled
     control must READ as disabled (Chris, on the
     Table Style editor's locked Text height
     field: "disabled, but not grey"). One shared
     rule for every dialog input, select and
     textarea; the light theme overrides below. */
  .modal-card input:disabled, .modal-card select:disabled, .modal-card textarea:disabled,
  .ins-input:disabled { background: #161616; color: #6e6e6e; border-color: #383838; cursor: not-allowed; }
  .modal-card input[type="checkbox"]:disabled, .modal-card input[type="radio"]:disabled { opacity: 0.45; }
.lock-card input:focus { box-shadow: 0 0 0 3px rgba(87, 167, 115, 0.22); }
button:focus-visible, .tool:focus-visible, .tb-btn:focus-visible, .rtab:focus-visible, .ssc-tab:focus-visible { outline: 2px solid rgba(87, 167, 115, 0.65); outline-offset: 1px; }
::-webkit-scrollbar-thumb { border-radius: 6px; }
.lp-filters::-webkit-scrollbar-thumb, .lp-table-wrap::-webkit-scrollbar-thumb, .palette-body::-webkit-scrollbar-thumb, .layers-box::-webkit-scrollbar-thumb, .command-history::-webkit-scrollbar-thumb, .suggest::-webkit-scrollbar-thumb, .tw-body::-webkit-scrollbar-thumb, #mtBody::-webkit-scrollbar-thumb, .mt-tools::-webkit-scrollbar-thumb, .opt-pages::-webkit-scrollbar-thumb { border-radius: 7px; }
#pdfProg{position:fixed;top:64px;left:50%;transform:translateX(-50%);z-index:950;min-width:340px;padding:10px 14px;border-radius:8px;background:#1e1e1e;color:#eee;border:1px solid #444;box-shadow:0 6px 24px rgba(0,0,0,.45);font:13px system-ui,sans-serif}
body[data-theme="light"] #pdfProg{background:#ffffff;color:#222;border-color:#bbb}
#pdfProgLabel{margin-bottom:8px}
.pdf-prog-track{height:8px;border-radius:4px;background:rgba(127,127,127,.35);overflow:hidden}
#pdfProgBar{height:100%;width:0%;background:#57a773;border-radius:4px;transition:width .15s ease}
#pdfProgBar.indet{animation:pdfProgSlide 1.1s ease-in-out infinite alternate}
@keyframes pdfProgSlide{from{margin-left:0}to{margin-left:65%}}

  /* ---- detached panels (V0.84.11) ---- */
  body.pal-pop { margin: 0; height: 100vh; overflow: hidden; }
  /* Windowed-panel right inset (V0.84.40): on Windows the frameless
     PiP window's invisible resize border strip (roughly 10-12 px
     along the window's right edge) sits over the right portion of
     a windowed panel's 15 px scrollbar, so only a left sliver of
     the bar grabs for drags, track paging, and hover (round-3
     diagnosis; the detached popup, which has a real frame, is
     unaffected there, and this same shell serves both hosts).
     Padding the panel root 14 px on the right insets ALL of the
     panel's content, header controls included, by that amount:
     the global box-sizing is border-box, so the root's 100% width
     includes this padding, and every scroller nested in the panel
     (Layers table wrap and filters, Properties body, Text Window
     body) ends at least 14 px inside the window, clear of the
     strip. The panel background still paints the full window
     width (the padding area is the root's own box). Only pal-pop
     documents carry this: docked and floating panels in the main
     document are untouched. The .pz resize handles are the only
     absolutely positioned elements anchored to the root's right
     edge, and they are display: none in both windowed states
     (.pal-detached / .pal-pinned), so nothing pokes back into
     the strip. The declaration is !important, like this rule's
     width, height, and offsets, for one measured reason: a panel
     detached from a dock carries the docked state's inline
     padding-right (the V0.74.3 pzSyncHandles scrollbar inset,
     4 px when an east resize handle was showing) into the popup
     with it - the window-move strip clears inline width, height,
     and flex geometry but not padding - and a plain declaration
     would lose to that inline style in the detached host (the
     geometry probe measured exactly that: computed 4 px, gap
     4 px, before the !important). No legitimate inline right
     padding exists in a windowed document: the handles are
     hidden there and pzSyncHandles clears, never sets, the
     inline padding while a panel is off-window. */
  body.pal-pop > .dock-panel { width: 100% !important; height: 100% !important; max-height: none; border: none; border-radius: 0; box-shadow: none; position: relative; left: auto !important; top: auto !important; padding-right: 14px !important; }
  body.pal-pop > .layers-panel { width: 100% !important; }
  body.pal-pop .pal-body { height: calc(100% - 30px); }
  body.pal-pop > .dock-panel.pal-side-l, body.pal-pop > .dock-panel.pal-side-r { flex-direction: column !important; }
  body.pal-pop .palette-header { writing-mode: horizontal-tb !important; flex-direction: row !important; width: auto !important; height: 30px !important; justify-content: flex-start !important; padding: 0 10px !important; }
  body.pal-pop .palette-header .pal-cluster { margin-left: auto !important; margin-top: 0 !important; flex-direction: row !important; }
  body.pal-pop .pal-win-ah > *:not(.palette-header):not(.pz) { display: none !important; }
  /* Windowed panels (PiP / detached): the shared panel-scroller rule's
     scrollbar-color switches these scrollers to the standard scrollbar,
     whose thumb does not drag in a document.write-created window (only a
     left sliver of the bar grabs; presses elsewhere reach the element but
     start no drag). Neutralize scrollbar-color inside pal-pop documents
     so the themed webkit bar (15px, always visible) carries windowed
     panels too. Docked and floating panels in the main document are
     untouched by this rule. */
  body.pal-pop .lp-filters, body.pal-pop .lp-table-wrap, body.pal-pop .palette-body, body.pal-pop .layers-box, body.pal-pop .command-history, body.pal-pop .suggest, body.pal-pop .tw-body, body.pal-pop #mtBody, body.pal-pop .mt-tools, body.pal-pop .rp-list, body.pal-pop .opt-pages, body.pal-pop .dim-pages, body.pal-pop #osList, body.pal-pop .help-main, body.pal-pop #helpList, body.pal-pop .drive-list { scrollbar-color: auto; }
  .palette-header .pal-detach { cursor: pointer; display: flex; align-items: center; color: #8a8a8a; padding: 3px; }
  .palette-header .pal-detach .icon { width: 12px; height: 12px; }
  .palette-header .pal-detach:hover { color: #dddddd; }
  /* Pin control (V0.84.17): an ordinary in-flow member of the
     header cluster; the V0.84.13 absolute placement is gone,
     so no header control is scattered or centered. */
  .palette-header .pal-pip { cursor: pointer; display: flex; align-items: center; color: #8a8a8a; padding: 3px; }
  .palette-header .pal-pip .icon { width: 12px; height: 12px; }
  .palette-header .pal-pip:hover { color: #dddddd; }
  .palette-header .pal-dock { cursor: pointer; display: flex; align-items: center; gap: 4px; color: #8a8a8a; padding: 3px; font-size: 11px; }
  .palette-header .pal-dock .icon { width: 12px; height: 12px; }
  .palette-header .pal-dock:hover { color: #dddddd; }
  .palette-header .pal-unpip { cursor: pointer; display: flex; align-items: center; gap: 4px; color: #8a8a8a; padding: 3px; font-size: 11px; }
  .palette-header .pal-unpip .icon { width: 12px; height: 12px; }
  .palette-header .pal-unpip:hover { color: #dddddd; }
  /* Per-home cluster visibility (V0.84.17, F.2): the ONLY
     visibility source for header controls. Docked shows
     Auto-hide, Undock, Pin, Close. Windowed (pal-detached)
     shows Auto-hide, Dock, Pin, Close. Pinned shows
     Auto-hide (visible, inert), Undock, Unpin, Close. */
  .pal-detached .pal-detach { display: none !important; }
  .pal-pinned .pal-pip { display: none !important; }
  .pal-pinned .pal-dock { display: none !important; }
  .dock-panel:not(.pal-detached) .pal-dock { display: none !important; }
  .dock-panel:not(.pal-pinned) .pal-unpip { display: none !important; }
  .pal-detached .pz, .pal-pinned .pz { display: none !important; }
  .pal-detached .tb-dots, .pal-pinned .tb-dots { display: none !important; }
  .tb-check.detached { width: auto; font-size: 10px; color: #9fd6b4; }
  .tb-check.pinned { width: auto; font-size: 10px; color: #a8c8e8; }
  .tb-check.window { width: auto; font-size: 10px; color: #9fd6b4; }
  .tb-check.window-hidden { width: auto; font-size: 10px; color: #8a8a8a; }
