:root {
  color-scheme: dark;
  --chrome:#20262c; --chrome-2:#293038; --chrome-3:#313942;
  --line:#46515b; --line-soft:#35404a; --canvas:#0b0f12;
  --text:#edf2f5; --muted:#aeb8c0; --accent:#16c76f;
  --accent-dark:#0c6f43; --danger:#f05252; --warning:#ffd166;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Tahoma,Arial,sans-serif;
}
* { box-sizing:border-box; }
html,body { margin:0; width:100%; height:100%; overflow:hidden; background:var(--canvas); color:var(--text); }
body { font-size:14px; line-height:1.3; -webkit-user-select:none; user-select:none; overscroll-behavior:none; }
button,input,select { font:inherit; }
button { color:var(--text); }
#mcad-app { --ribbon-height:132px; width:100%; max-width:100%; height:100vh; height:100dvh; min-width:720px; overflow:hidden; display:grid; grid-template-areas:"title" "menu" "tabs" "ribbon" "property" "workspace" "layouts" "command" "status"; grid-template-rows:34px 29px 34px var(--ribbon-height) 38px minmax(0,1fr) 31px 68px 32px; background:var(--chrome); }
#mcad-app.ribbon-collapsed { --ribbon-height:0px; }
#mcad-app > * { min-width:0; }
.titlebar { grid-area:title; }
.menubar { grid-area:menu; }
.ribbon-tabs { grid-area:tabs; }
.ribbon { grid-area:ribbon; }
.propertybar { grid-area:property; }
.workspace { grid-area:workspace; }
.layout-tabs { grid-area:layouts; }
.command-area { grid-area:command; }
.statusbar { grid-area:status; }

/* desktop title/menu chrome */
.titlebar { display:flex; align-items:center; gap:10px; padding:0 10px; background:#1c2228; border-bottom:1px solid #101418; }
.titlebar img { width:23px; height:23px; object-fit:contain; filter:invert(1); }
.titlebar .app-title { color:#f5f7f8; font-weight:600; }
.titlebar .doc-title { color:#aeb7bd; }
.titlebar .quick { display:flex; gap:2px; margin-left:12px; }
.titlebar .license { margin-left:auto; color:#62ff9e; font-weight:700; letter-spacing:.02em; }
.titlebar .window-controls { display:flex; margin-left:14px; align-self:stretch; }
.window-controls span { width:38px; display:grid; place-items:center; color:#aeb8bf; }
.window-controls .close:hover { background:#b3272d; color:white; }
.icon-btn { border:0; background:transparent; min-width:30px; height:28px; padding:0 6px; border-radius:2px; }
.icon-btn:hover { background:#36414a; }

.menubar { display:flex; align-items:center; gap:2px; padding:0 7px; background:#1c2228; border-bottom:1px solid var(--line-soft); overflow:hidden; }
.menu-item { padding:5px 10px; border:0; background:transparent; border-radius:2px; }
.menu-item:hover,.menu-item.active { background:#33404a; }
.menubar .trial-btn { margin-left:auto; padding:4px 11px; color:#07170e; background:var(--accent); border:1px solid #56e59a; border-radius:2px; font-weight:700; }
.menubar .account-btn { margin-left:auto; padding:4px 11px; color:#edf2f5; background:#26333c; border:1px solid #586b78; border-radius:2px; }
.menubar .account-btn + .trial-btn { margin-left:6px; }

.ribbon-tabs { display:flex; align-items:end; gap:1px; padding-left:166px; background:#1f262d; border-bottom:1px solid var(--line); position:relative; overflow:hidden; }
.brand-chip { position:absolute; left:12px; top:0; bottom:0; display:flex; align-items:center; gap:8px; font-weight:800; letter-spacing:.04em; }
.brand-chip > img { width:31px; height:20px; object-fit:contain; filter:invert(1); }
.brand-chip .mode { font-size:11px; color:#6bffa5; border:1px solid #36895a; padding:2px 7px; border-radius:10px; letter-spacing:0; }
.ribbon-tab { height:33px; min-width:74px; padding:0 13px; border:0; background:transparent; border-bottom:3px solid transparent; }
.ribbon-tab:hover { background:#2b343c; }
.ribbon-tab.active { background:#303a43; border-bottom-color:#2dcfda; }
.ribbon-collapse { margin-left:auto; margin-right:10px; border:0; background:transparent; color:#c9d0d5; height:30px; }

.ribbon { display:flex; overflow-x:auto; overflow-y:hidden; background:#2c343c; border-bottom:1px solid #11181d; scrollbar-width:thin; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
.ribbon-page { display:none; min-width:max-content; height:100%; padding:5px 5px 3px; gap:5px; }
.ribbon-page.active { display:flex; }
.ribbon-panel { min-width:118px; border-right:1px solid #4b555f; padding:2px 7px 20px; position:relative; display:grid; grid-template-columns:repeat(3,minmax(34px,1fr)); grid-auto-rows:46px; gap:3px; align-content:start; }
.ribbon-panel.wide { min-width:210px; }
.ribbon-panel.form { min-width:170px; grid-template-columns:1fr; grid-auto-rows:29px; }
.panel-title { position:absolute; left:0; right:0; bottom:1px; text-align:center; color:#b8c1c7; font-size:12px; }
.tool { border:1px solid transparent; background:transparent; border-radius:2px; min-width:44px; padding:3px 6px; display:flex; flex-direction:column; justify-content:center; align-items:center; gap:2px; color:#edf1f4; }
.tool:hover { border-color:#5b7485; background:#3b4750; }
.tool.active,.tool.on { background:#1b6e72; border-color:#43d7db; }
.tool.locked { color:#ffe198; border-color:#735f28; }
.tool .ico { font:700 18px/1 "Segoe UI Symbol","Segoe UI"; color:#f4c84a; }
.tool .lbl { font-size:12px; white-space:nowrap; }
.tool.big { grid-row:span 2; }
.tool.big .ico { font-size:26px; }
.ribbon-form { width:100%; height:27px; border:1px solid #56616b; color:#edf2f5; background:#20262b; padding:0 7px; }
.ribbon.collapsed { display:none; }

.propertybar { display:flex; align-items:center; gap:7px; padding:4px 9px; background:#242c33; border-bottom:1px solid #11171b; }
.propertybar label { color:#c3cbd0; }
.propertybar select { min-width:150px; height:27px; border:1px solid #53606a; background:#182026; color:white; padding:0 7px; }
.propertybar .swatch { width:15px; height:15px; background:#fff; border:1px solid #777; display:inline-block; vertical-align:-2px; margin-right:6px; }
.propertybar .palette-toggle { margin-left:auto; }

.workspace { min-width:0; min-height:0; overflow:hidden; display:grid; grid-template-columns:230px minmax(300px,1fr) 242px; background:#0c1114; }
.palette { background:#22292f; border-color:#101417; display:flex; flex-direction:column; min-width:0; }
.palette.left { border-right:1px solid #4a545c; }
.palette.right { border-left:1px solid #4a545c; }
.palette-head { height:31px; display:flex; align-items:center; padding:0 9px; background:#303840; border-bottom:1px solid #4c565e; font-weight:600; }
.palette-head .x { margin-left:auto; color:#aeb8bf; }
.palette-select { margin:7px; height:28px; background:#131a1f; color:#eee; border:1px solid #4a5862; }
.palette-search { margin:0 7px 7px; height:28px; background:#151b20; color:#eee; border:1px solid #45525b; padding:0 8px; }
.prop-table { width:100%; border-collapse:collapse; font-size:13px; }
.prop-table th,.prop-table td { border-bottom:1px solid #39434b; padding:6px 8px; text-align:left; }
.prop-table th { color:#cbd3d8; background:#293139; font-weight:500; }
.prop-table td:last-child { color:#fff; }
.symbol-list { overflow:auto; padding:5px; }
.symbol-card { display:grid; grid-template-columns:50px 1fr; align-items:center; gap:8px; min-height:55px; padding:5px; border-bottom:1px solid #343e46; }
.symbol-card:hover { background:#303a42; }
.symbol-shape { color:#dbe5eb; font-size:29px; text-align:center; }
.symbol-card small { color:#9eabb4; display:block; }

.drawing-host { min-width:0; min-height:0; display:grid; grid-template-rows:31px minmax(120px,1fr); }
.document-tabs { display:flex; align-items:end; background:#1b2228; border-bottom:1px solid #48545d; }
.document-tab { height:29px; min-width:116px; border:0; border-right:1px solid #34404a; background:#293139; color:#cbd3d8; text-align:left; padding:0 10px; }
.document-tab.active { background:var(--accent); color:#07150d; font-weight:700; }
.document-tab .tab-x { float:right; }
.new-tab { border:0; background:transparent; width:34px; height:28px; font-size:18px; }
.mobile-cad-tools { display:none; margin-left:auto; height:100%; align-items:center; }
.mobile-cad-tools button { width:52px; height:100%; min-height:44px; border:0; border-left:1px solid #3f4a53; background:#263139; color:#edf2f5; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:0; padding:1px; }
.mobile-cad-tools button b { color:#f4c84a; font-size:17px; line-height:16px; }
.mobile-cad-tools button span { font-size:10px; line-height:13px; }
.mobile-cad-tools button:active { background:#1b6e72; }
.mobile-cad-tools .danger { color:#ff8787; }
#drawing-stage { position:relative; min-height:0; overflow:hidden; background-color:var(--canvas); }
#demo-home { position:absolute; z-index:10; inset:12px; display:flex; flex-direction:column; justify-content:center; gap:12px; padding:16px; border:1px solid #46545e; border-radius:6px; background:linear-gradient(145deg,#182127f2,#0e1519f7); box-shadow:0 12px 45px #0009; overflow:auto; }
#demo-home.hidden { display:none; }
.demo-home-head { display:flex; align-items:end; justify-content:space-between; gap:18px; }
.demo-home-head > div { display:grid; gap:3px; }
.demo-home-head b { color:#6ee5a2; font-size:20px; }
.demo-home-head span,.demo-card span { color:#aeb8c0; }
.demo-open { flex:0 0 auto; padding:8px 12px; border:1px solid #5c6d77; border-radius:3px; background:#263139; color:#edf2f5; cursor:pointer; }
.demo-grid { display:grid; grid-template-columns:repeat(5,minmax(125px,1fr)); gap:9px; }
.demo-card { min-width:0; padding:7px; border:1px solid #46545e; border-radius:4px; background:#202a31; text-align:left; cursor:pointer; }
.demo-card:hover,.demo-card:focus-visible { border-color:#65e7a0; background:#29363e; outline:0; }
.demo-card.loading { opacity:.55; pointer-events:none; }
.demo-card img { display:block; width:100%; aspect-ratio:16/10; margin-bottom:6px; border:1px solid #35434b; border-radius:2px; background:#10171b; object-fit:cover; }
.demo-card b,.demo-card span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#drawing-stage.grid-on { background-image:linear-gradient(rgba(70,92,102,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(70,92,102,.18) 1px,transparent 1px); background-size:24px 24px; }
#c,#t { position:absolute; inset:0; display:block; width:100%; height:100%; touch-action:none; }
#c { cursor:crosshair; }
#t { pointer-events:none; }
.axis { position:absolute; left:17px; bottom:16px; width:63px; height:63px; pointer-events:none; color:#f04d56; }
.axis::before,.axis::after { content:""; position:absolute; left:12px; bottom:12px; background:currentColor; }
.axis::before { width:45px; height:2px; }
.axis::after { width:2px; height:45px; background:#38d17f; }
.axis b { position:absolute; font-weight:500; }
.axis .x { right:0; bottom:4px; color:#f04d56; }.axis .y { left:5px; top:0; color:#38d17f; }
.viewcube { position:absolute; top:12px; right:14px; width:54px; height:54px; border:1px solid #60717d; transform:rotate(30deg) skew(-7deg); display:grid; place-items:center; color:#aab6be; background:#20282eaa; font-size:11px; }
.canvas-menu-button { display:none; position:absolute; z-index:12; top:72px; right:14px; width:44px; height:44px; place-items:center; padding:0; border:1px solid #657681; border-radius:4px; background:#263139e8; color:#f4c84a; font-size:25px; line-height:1; box-shadow:0 4px 14px #0008; }
.canvas-menu-button:active,.canvas-menu-button[aria-expanded="true"] { background:#1b6e72; border-color:#43d7db; }
.panel { position:absolute; background:rgba(20,25,29,.94); border:1px solid #4a5962; border-radius:3px; padding:10px 13px; box-shadow:0 5px 20px #0008; }
#hud { top:12px; left:12px; white-space:pre; pointer-events:none; max-width:330px; }
#hud b { color:#59d98c; }
#tip { bottom:15px; left:50%; transform:translateX(-50%); pointer-events:none; display:none; }
#drop { bottom:14px; right:14px; max-width:310px; }
#drop .hint,.dialog-panel .hint { color:#a5afb6; font-size:12px; margin-top:4px; }
#drop .link { color:#59d98c; text-decoration:underline; cursor:pointer; }
#drop.hot { border-color:#59d98c; background:rgba(21,83,51,.94); }

.layout-tabs { display:flex; align-items:center; padding-left:230px; background:#222a31; border-top:1px solid #46515a; }
.layout-tab { align-self:stretch; min-width:70px; border:0; border-right:1px solid #3f4a53; background:#2c353d; color:#bec7cd; }
.layout-tab.active { background:#3c4953; color:#fff; border-top:2px solid #2bcf77; }
.layout-tabs .plus { width:34px; border:0; background:transparent; }
.command-area { margin-left:230px; display:grid; grid-template-rows:31px 37px; background:#141b20; border-top:1px solid #4b565f; }
.command-state { display:flex; align-items:center; gap:9px; background:#27455c; padding:0 10px; color:white; font-weight:600; }
.command-state .cancel { margin-left:auto; }
.command-input { display:flex; align-items:center; gap:8px; padding:0 11px; color:#9eaab2; }
.command-input input { flex:1; min-width:80px; height:28px; background:#11171b; color:white; border:1px solid #303b43; padding:0 8px; }
.statusbar { display:flex; align-items:center; gap:2px; background:#222a30; border-top:1px solid #4b555e; padding:0 6px; }
.status-coord { min-width:225px; color:#83a8c3; font-family:Consolas,monospace; }
.status-chip { height:26px; border:1px solid #3f4a52; background:#293239; color:#d2d8dc; padding:0 8px; }
.status-chip.on { background:#177c86; border-color:#36c8d4; color:white; }
.status-chip.locked { color:#ffe19a; }
.status-spacer { margin-left:auto; }

.dialog-panel { display:none; position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); width:380px; max-width:calc(100vw - 28px); background:#181f24; border:1px solid #65737d; padding:16px; z-index:40; box-shadow:0 18px 70px #000d; }
.dialog-panel h3 { margin:0 0 8px; font-size:18px; }
.dialog-panel input { display:block; width:100%; margin:7px 0; background:#10161a; border:1px solid #53616a; color:#eee; padding:9px 10px; }
.dialog-panel .row { display:flex; gap:8px; margin-top:12px; }
.dialog-panel .row button { flex:1; min-height:34px; border:1px solid #53616a; background:#293239; }
button.cta { background:var(--accent)!important; color:#07150d!important; border-color:#59e69a!important; font-weight:700; }
button.locked { color:var(--warning); }
#trial-msg { min-height:18px; margin-top:6px; color:#ff7c7c; }
#trial-msg.ok { color:#59d98c; }
#account-msg { min-height:18px; margin-top:6px; color:#ff8d8d; }
.auth-separator { display:flex; align-items:center; gap:8px; color:#9da9b1; margin:10px 0 2px; }
.auth-separator::before,.auth-separator::after { content:""; height:1px; flex:1; background:#44515a; }
.legal-links { margin-top:9px; color:#9da9b1; font-size:11px; line-height:1.45; }
.legal-links a { color:#6fe3a1; }

.cad-context { display:none; position:fixed; z-index:80; min-width:210px; padding:5px;
  background:#20282e; border:1px solid #687781; box-shadow:0 12px 36px #000c; }
.cad-context.open { display:grid; }
.cad-context button { min-height:30px; padding:5px 10px; border:0; background:transparent;
  color:#edf2f5; text-align:left; }
.cad-context button:hover { background:#3b4953; }
.cad-context button.danger { color:#ff8585; }
.cad-context hr { width:100%; margin:4px 0; border:0; border-top:1px solid #45515a; }
.feature-body { display:grid; gap:9px; color:#c7d0d6; }
.feature-body label { display:grid; grid-template-columns:120px 1fr; gap:9px; align-items:center; }
.feature-body input,.feature-body select,.feature-body textarea { width:100%; min-height:32px;
  color:#edf2f5; background:#10171b; border:1px solid #53616a; padding:5px 8px; }
.feature-body textarea { min-height:82px; resize:vertical; }
.feature-summary { padding:8px; border:1px solid #3f4c55; background:#11181d; white-space:pre-wrap; }
.feature-menu { display:grid; gap:3px; }
.feature-menu button { min-height:34px; padding:6px 10px; color:#edf2f5; background:#263038;
  border:1px solid #46535d; text-align:left; }
.feature-menu button:hover { background:#35434d; }
.tool.unavailable { color:#ff8d8d; border-color:#8c3333; }

@media (max-width:1100px) {
  #mcad-app { min-width:680px; }
  .workspace { grid-template-columns:190px minmax(300px,1fr); }
  .palette.right { display:none; }
  .layout-tabs,.command-area { padding-left:190px; margin-left:0; }
  .canvas-menu-button { display:grid; }
  .drawing-host { grid-template-rows:45px minmax(120px,1fr); }
  .document-tabs { align-items:stretch; overflow-x:auto; overflow-y:hidden; }
  .document-tab,.new-tab { height:44px; flex:0 0 auto; }
  .mobile-cad-tools { display:flex; flex:0 0 auto; }
}
@media (max-width:760px) {
  #mcad-app { --ribbon-height:104px; min-width:0; grid-template-rows:40px 38px 40px var(--ribbon-height) 0 minmax(0,1fr) 38px 38px 40px; padding-top:env(safe-area-inset-top); }
  .titlebar .doc-title,.titlebar .window-controls,.titlebar .quick,.license { display:none; }
  .titlebar { padding-left:max(10px,env(safe-area-inset-left)); padding-right:max(10px,env(safe-area-inset-right)); }
  .titlebar img { width:25px; height:25px; }
  .titlebar .app-title { font-size:17px; }
  .menubar { padding:0 max(4px,env(safe-area-inset-left)); overflow-x:auto; overflow-y:hidden; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
  .menu-item { flex:0 0 auto; min-height:36px; padding:5px 12px; }
  .menubar .account-btn { flex:0 0 auto; max-width:150px; margin-left:auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .menubar .trial-btn { display:none; }
  .ribbon-tabs { align-items:stretch; padding-left:max(4px,env(safe-area-inset-left)); overflow-x:auto; overflow-y:hidden; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
  .ribbon-tabs::-webkit-scrollbar,.menubar::-webkit-scrollbar,.statusbar::-webkit-scrollbar { display:none; }
  .brand-chip { display:none; }
  .ribbon-tab { flex:0 0 auto; height:40px; min-width:74px; padding:0 12px; scroll-snap-align:start; }
  .ribbon-collapse { display:none; }
  .ribbon { overflow-x:auto; scroll-snap-type:x proximity; }
  .ribbon-page { padding:3px 3px 2px; gap:3px; }
  .ribbon-panel { min-width:108px; padding:1px 5px 15px; grid-template-columns:repeat(3,minmax(32px,1fr)); grid-auto-rows:40px; gap:1px; scroll-snap-align:start; }
  .ribbon-panel.wide { min-width:196px; }
  .ribbon-panel.form { min-width:150px; grid-auto-rows:25px; }
  .panel-title { font-size:10px; }
  .tool { min-width:40px; min-height:40px; padding:2px 4px; }
  .tool .ico { font-size:16px; }
  .tool.big .ico { font-size:22px; }
  .tool .lbl { font-size:10px; }
  .workspace { grid-template-columns:1fr; }
  .palette { display:none; }
  .propertybar { display:none; }
  .layout-tabs { padding-left:0; }
  .layout-tab { min-width:84px; }
  .command-area { margin-left:0; }
  .command-area { grid-template-rows:38px; }
  .command-input { display:none; }
  .command-state { min-width:0; padding:0 8px; font-size:12px; }
  .command-state > span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .command-state .cancel { flex:0 0 auto; }
  .statusbar { min-width:0; overflow-x:auto; overflow-y:hidden; padding:0 max(5px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(5px,env(safe-area-inset-left)); overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
  .status-coord { display:none; }
  .status-chip { flex:0 0 auto; min-width:66px; min-height:32px; padding:0 7px; }
  .status-spacer { display:none; }
  #hud { display:none; }
  #drop { left:8px; right:8px; bottom:8px; max-width:none; padding:9px 11px; }
  #demo-home { inset:7px; justify-content:flex-start; padding:10px; }
  .demo-home-head { align-items:start; }
  .demo-home-head b { font-size:16px; }
  .demo-home-head span { font-size:11px; }
  .demo-grid { grid-template-columns:repeat(5,150px); overflow-x:auto; padding-bottom:4px; scroll-snap-type:x mandatory; }
  .demo-card { scroll-snap-align:start; }
  #drop .hint { font-size:11px; line-height:1.35; }
  .axis { left:8px; bottom:8px; transform:scale(.8); transform-origin:left bottom; }
  .viewcube { top:8px; right:8px; transform:rotate(30deg) skew(-7deg) scale(.8); transform-origin:top right; }
  .canvas-menu-button { display:grid; top:60px; right:8px; }
  .dialog-panel { max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow:auto; }
  .cad-context { max-width:calc(100vw - 16px); max-height:calc(100dvh - 16px); overflow:auto; }
}

@media (max-width:430px) {
  #mcad-app { --ribbon-height:96px; grid-template-rows:38px 36px 38px var(--ribbon-height) 0 minmax(0,1fr) 36px 36px 38px; }
  .titlebar .app-title { font-size:16px; }
  .menu-item { padding-inline:10px; }
  .menubar .account-btn { max-width:118px; }
  .ribbon-tab { height:38px; min-width:70px; padding-inline:10px; }
  .ribbon-panel { grid-auto-rows:36px; padding-bottom:14px; }
  .tool { min-height:36px; }
  .tool .lbl { max-width:62px; overflow:hidden; text-overflow:ellipsis; }
  .layout-tab { min-width:76px; }
  .command-state .cancel { font-size:0; }
  .command-state .cancel::after { content:"Esc"; font-size:12px; }
}

@media (orientation:landscape) and (max-width:1000px) and (max-height:560px) {
  #mcad-app { --ribbon-height:82px; min-width:0; grid-template-rows:0 32px 34px var(--ribbon-height) 0 minmax(0,1fr) 30px 32px 34px; padding-top:env(safe-area-inset-top); }
  .titlebar { display:none; }
  .menubar { padding:0 max(4px,env(safe-area-inset-left)); overflow-x:auto; overflow-y:hidden; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
  .menu-item { min-height:30px; padding:3px 11px; }
  .menubar .account-btn { flex:0 0 auto; max-width:150px; margin-left:auto; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .menubar .trial-btn { display:none; }
  .ribbon-tabs { align-items:stretch; padding-left:max(4px,env(safe-area-inset-left)); overflow-x:auto; overflow-y:hidden; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
  .brand-chip,.ribbon-collapse { display:none; }
  .ribbon-tab { height:34px; }
  .ribbon { overflow-x:auto; overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
  .ribbon-page { padding-top:2px; }
  .ribbon-panel { min-width:100px; grid-auto-rows:31px; padding-bottom:13px; }
  .ribbon-panel.wide { min-width:184px; }
  .ribbon-panel.form { min-width:140px; grid-auto-rows:22px; }
  .tool { min-width:38px; min-height:31px; padding:1px 3px; }
  .tool .ico { font-size:14px; }
  .tool.big .ico { font-size:19px; }
  .tool .lbl,.panel-title { font-size:9px; }
  .propertybar,.palette { display:none; }
  .workspace { grid-template-columns:1fr; }
  .drawing-host { grid-template-rows:40px minmax(0,1fr); }
  .document-tab,.new-tab { height:39px; }
  .mobile-cad-tools button { width:48px; min-height:39px; }
  .layout-tabs { padding-left:0; }
  .command-area { margin-left:0; padding-left:0; grid-template-rows:32px; }
  .command-input { display:none; }
  .command-state { min-width:0; padding:0 8px; font-size:11px; }
  .command-state > span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .command-state .cancel { flex:0 0 auto; }
  .statusbar { min-width:0; overflow-x:auto; overflow-y:hidden; padding:0 max(5px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(5px,env(safe-area-inset-left)); overscroll-behavior-x:contain; -webkit-overflow-scrolling:touch; }
  .status-coord,.status-spacer,#hud { display:none; }
  .status-chip { flex:0 0 auto; min-width:62px; min-height:28px; padding:0 6px; }
  #drop { left:auto; width:min(320px,calc(100vw - 16px)); }
  .canvas-menu-button { display:grid; top:66px; right:8px; width:42px; height:42px; }
  .layout-tab { min-width:72px; }
}

@media (pointer:coarse) and (min-height:561px) {
  button,.link,select { touch-action:manipulation; }
  .menu-item,.ribbon-tab,.layout-tab { min-height:38px; }
  .canvas-menu-button { display:grid; }
  .cad-context button { min-height:44px; }
}
