html.mobile-cad, .mobile-cad body {
  width: 100%; height: 100%; min-width: 0; margin: 0; overflow: hidden;
  overscroll-behavior: none; background: #191c20;
}
.mobile-cad #app {
  box-sizing: border-box; width: 100%; min-width: 0; height: 100dvh;
  display: flex; flex-direction: column; overflow: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.mobile-cad .topbar, .mobile-cad .ribbon, .mobile-cad .document-bar,
.mobile-cad .statusbar, .mobile-cad .command-history, .mobile-cad .history-toggle,
.mobile-cad .workspace-controls, .mobile-cad .workspace-restore,
.mobile-cad .personal-toolbar63, .mobile-cad .space-tabs,
.mobile-cad .dock-zone63, .mobile-cad .axis-widget, .mobile-cad .drawing-badge,
.mobile-cad .canvas-bottom, .mobile-cad .canvas-head, .mobile-cad .command-tip {
  display: none !important;
}
.mobile-cad .workspace { flex: 1; display: flex !important; min-height: 80px; min-width: 0; overflow: hidden; }
.mobile-cad .drawing-area { flex: 1; min-width: 0; min-height: 0; margin: 0; }
.mobile-cad #canvas { width: 100%; height: 100%; outline: 0; touch-action: none; -webkit-user-select: none; user-select: none; }
.mobile-cad button, .mobile-cad a.button, .mobile-cad select { min-height: 44px; touch-action: manipulation; }
.mobile-cad input, .mobile-cad select, .mobile-cad textarea { font-size: 16px !important; }
.mobile-top {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-width: 0;
  padding: 5px 8px; background: #242629; border-bottom: 1px solid #454a50;
}
.mobile-title { flex: 1; min-width: 0; }
.mobile-title strong { display: block; font-size: 18px; letter-spacing: -.4px; }
.mobile-title span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: #b9c4cd; }
.mobile-top button { min-width: 44px; border: 1px solid #535960; background: #33383f; color: #edf2f7; padding: 7px; }
.mobile-top svg, .mobile-tools svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.mobile-tools { display: flex; gap: 4px; overflow-x: auto; flex: 0 0 auto; padding: 5px; background: #252a30; scrollbar-width: none; }
.mobile-tools button { flex: 0 0 65px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 3px; min-height: 58px; border: 1px solid transparent; color: #d8e0e8; background: transparent; font-size: 14px; }
.mobile-tools button.active { border-color: #7ebcf4; background: #325777; color: #fff; }
.mobile-hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: 0 0 auto; min-height: 28px; padding: 2px 9px; background: #20252b; color: #b8c8d7; font-size: 14px; }
.mobile-hint #mobile-prompt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-hint button { flex: 0 0 auto; min-height: 38px; color: #e9f2fb; background: #354352; border: 1px solid #596d80; padding: 3px 10px; font-size: 14px; }
.mobile-cad .command-panel { flex: 0 0 auto; height: auto !important; min-height: 0; margin: 0; }
.mobile-cad .command-row { min-height: 44px; padding: 0 8px; }
.mobile-cad .command-row input { min-width: 0; width: 100%; height: 44px; }
.mobile-cad .command-row label, .mobile-cad .command-chevron { display: none; }
.mobile-cad .command-row button { min-width: 44px; background: #354c61; color: white; border: 0; padding: 8px; }
.mobile-cad dialog, .mobile-cad #dialog {
  box-sizing: border-box; min-width: 0 !important; width: calc(100% - 20px) !important;
  max-width: 540px !important; max-height: 84dvh !important; height: auto;
  margin: auto !important; left: 0 !important; top: 0 !important; right: 0; bottom: 0;
  resize: none !important; overflow: auto;
}
.mobile-cad .dialog-head { touch-action: auto; cursor: default; }
.mobile-cad .dialog-head h2 { font-size: 18px; }
.mobile-cad #dialog-body { padding: 14px; overflow-wrap: anywhere; font-size: 16px; }
.mobile-cad .dialog-close { font-size: 24px; width: 44px; height: 44px; }
.mobile-cad .dialog-foot { flex-wrap: wrap; }
.mobile-cad .form-grid, .mobile-cad .export-options { grid-template-columns: 1fr !important; }
.mobile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mobile-grid button, .mobile-save-link { display: flex; gap: 9px; align-items: center; padding: 12px; border: 1px solid #616f7c; background: #343e49; color: #f1f5f9; font-size: 16px; text-decoration: none; }
.mobile-grid svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.mobile-cad .cad-palette63 { display: none !important; }
.mobile-cad .cad-palette63[data-mobile-active="true"] {
  display: block !important; position: fixed !important; box-sizing: border-box;
  z-index: 100; inset: auto 8px calc(126px + env(safe-area-inset-bottom)) 8px !important;
  width: auto !important; height: min(55dvh, 440px) !important; overflow: auto;
  border: 1px solid #7991a6; background: #2d3034;
}
.mobile-cad .palette-controls63 select, .mobile-cad .dialog-maximize { display: none; }
.mobile-cad .cad-palette63 .layer-row, .mobile-cad .cad-palette63 .prop-row { font-size: 14px; }
.mobile-top [data-action="mobile-update"] { position: fixed; top: calc(64px + env(safe-area-inset-top)); right: 10px; z-index: 200; font-size: 14px; }
.mobile-cad .toasts { top: calc(62px + env(safe-area-inset-top)); bottom: auto; left: 10px; right: 10px; max-width: none; z-index: 1000; }
.mobile-cad .toast { font-size: 14px; }
.mobile-start-error { position: fixed; inset: 20px; padding: 25px; background: #30343a; color: white; z-index: 2000; font: 16px sans-serif; }
@media (orientation: landscape) and (max-height: 550px) {
  .mobile-top { padding: 1px 8px; }
  .mobile-title span { display: none; }
  .mobile-tools { padding: 2px; }
  .mobile-tools button { min-height: 44px; flex-direction: row; flex-basis: 96px; }
  .mobile-hint { min-height: 25px; }
}

.mobile-cad .view-compass { top: 12px; right: 12px; }
