/* Mobile layout overrides are kept together; desktop layouts remain unchanged. */
.mobile-nav-toggle { display:none; }
@media (max-width:700px) {
  .layout,.main,.content { min-width:0; }
  .layout:not(.canvas-focus)>.sidebar { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:0 12px; padding:10px max(16px,env(safe-area-inset-right)) 10px max(16px,env(safe-area-inset-left)); }
  .sidebar .brand.platform-brand { width:auto; justify-content:flex-start; margin:0; padding:0; gap:10px; }
  .sidebar .platform-brand .brand-mark { width:40px; height:44px; }
  .sidebar .brand.platform-brand .brand-wordmarks { width:96px; max-width:96px; }
  .mobile-nav-toggle { display:flex; align-items:center; justify-content:center; gap:7px; min-width:76px; min-height:44px; padding:9px 12px; border:1px solid #47513b; border-radius:12px; color:#e1e9d7; background:#22291e; font-size:13px; }
  .mobile-nav-toggle svg { width:19px; height:19px; }
  .mobile-nav-toggle[aria-expanded=true] { border-color:#a4bf70; background:#34442b; }
  .sidebar:not(.mobile-nav-open)>nav { display:none; }
  .sidebar.mobile-nav-open>nav { display:block; grid-column:1/-1; max-height:60dvh; overflow-y:auto; overscroll-behavior:contain; margin-top:12px; padding:4px 0; }
  .sidebar nav>.nav { display:flex; width:100%; min-height:44px; margin:2px 0; }
  .sidebar .sidebar-group-items .nav { white-space:normal; }
  .topbar { padding:8px 14px; height:auto; min-height:62px; gap:8px; }
  .topbar .breadcrumb { flex:0 1 auto; min-width:0; max-width:85px; }
  .topbar .breadcrumb-current { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; }
  .topbar .topright { flex:1; width:auto; min-width:0; gap:8px; justify-content:flex-end; }
  .topbar .profile { flex:0 0 auto; padding:0; border:0; min-width:40px; min-height:44px; }
  .topbar .profile>div:last-child { display:none; }
  .topbar .topbar-credit { min-width:0; padding:0; font-size:12px; }
  .topbar .topbar-points { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:142px; font-size:12px; }
  .topbar .topbar-logout { width:40px; min-width:40px; height:44px; }
  .content { padding:20px 14px; }
  .content .pagehead,.workspace-heading { flex-wrap:wrap; }
  .content .pagehead>div { min-width:0; }
  .tablewrap { max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; }
  .tablewrap table { min-width:560px; }
  .content input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),.content textarea,.content select,
  .loginpage input,.assistant-panel textarea,dialog input:not([type=range]):not([type=checkbox]):not([type=radio]):not([type=color]),dialog textarea,dialog select { font-size:16px; }
  .create-page { padding-top:12px; }
  .create-welcome { padding-bottom:22px; }
  .create-welcome h1 { font-size:clamp(25px,7vw,32px); line-height:1.4; }
  .quick-create { padding:16px 14px 14px; }
  .create-controls>*,.create-model-picker { min-width:0; }
  #create-model-name,#create-summary { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #create-kind-toggle,#create-model-toggle,.create-setting-button,.create-upload { min-height:44px; }
  .create-helper-row { flex-wrap:wrap; gap:8px; line-height:1.7; }
  .create-model-families button,.create-model-variant { min-height:44px; }
  .canvas-focus .canvas-unified-toolbar { display:grid; grid-template-columns:36px minmax(0,1fr) auto; grid-template-rows:44px 48px; height:110px; min-height:110px; padding:6px 10px; gap:4px 8px; }
  .canvas-focus .canvas-unified-toolbar .canvas-title { min-width:0; width:100%; }
  .canvas-focus .canvas-unified-toolbar .canvas-title input { font-size:16px; max-width:none; }
  .canvas-focus .canvas-unified-toolbar .canvas-toolstrip { grid-column:1/-1; grid-row:2; width:100%; gap:8px; }
  .canvas-toolstrip>.canvas-tool-group:first-child { margin-left:0; }
  .canvas-focus .canvas-unified-toolbar .canvas-account { grid-column:3; grid-row:1; padding-left:8px; gap:8px; }
  .canvas-focus .canvas-unified-toolbar .canvas-back { min-height:44px; padding:6px; }
  .canvas-unified-toolbar .canvas-toolstrip button { min-width:44px; min-height:44px; }
  .canvas-unified-toolbar .canvas-account-avatar { min-width:40px; min-height:40px; }
  .canvas-account-points strong { max-width:100px; }
  .canvas-image-toolbar button { min-width:44px; min-height:44px; }
  .canvas-image-toolbar .cit-tools { overscroll-behavior-x:contain; }
  .assistant-panel textarea { font-size:16px; }
  .assistant-launch { width:64px; height:64px; }
  .text-assistant { right:max(12px,env(safe-area-inset-right)); bottom:max(12px,env(safe-area-inset-bottom)); }
  dialog:not(.video-editor-dialog):not(.image-editor-dialog) { max-width:calc(100vw - 20px); box-sizing:border-box; }
  .footer { padding-bottom:max(16px,env(safe-area-inset-bottom)); }
}
@media (max-width:760px) {
  dialog.image-editor-dialog[open] { display:flex; flex-direction:column; box-sizing:border-box; width:calc(100vw - 12px); height:calc(100dvh - 12px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); max-height:none; margin:auto; overflow:hidden; padding:0; }
  .image-editor-dialog .ipe-header { flex-shrink:0; padding:10px 14px; }
  .ipe-header h2 { font-size:18px; }
  .ipe-layout { display:flex; flex:1; flex-direction:column; min-height:0; overflow:hidden; }
  .ipe-workspace { flex:0 0 auto; padding:8px 10px; }
  .ipe-toolbar { margin-bottom:8px; gap:6px; }
  .image-editor-dialog button { min-height:44px; }
  .ipe-stage { min-height:100px; flex:none; padding:8px; }
  #ipe-canvas { max-height:24dvh; max-width:100%; }
  .ipe-image-meta { padding-top:8px; gap:8px; }
  #ipe-source { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .ipe-controls { display:block; flex:1 1 auto; min-height:0; max-height:none; overflow-y:auto; overscroll-behavior:contain; padding:0 16px 16px; border-top:1px solid #3d4945; }
  .ipe-controls>section { padding:14px 0; }
  .ipe-controls .ipe-transform { grid-template-columns:1fr 1fr; }
  .ipe-controls textarea,.ipe-controls select,.ipe-controls input[type=number] { font-size:16px; }
  .ipe-controls input[type=range] { min-height:36px; }
  .ipe-controls .ipe-modes { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); }
  .ipe-modes button { padding:8px 5px; }
  .ipe-footer { position:static; flex-shrink:0; padding:8px 10px; gap:5px; }
  .ipe-footer p { font-size:11px; max-height:34px; overflow:auto; }
  .ipe-footer>div { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
}
@media (max-height:500px) and (max-width:1000px) and (pointer:coarse) {
  dialog.image-editor-dialog[open] { display:flex; flex-direction:column; width:calc(100vw - 12px); height:calc(100dvh - 12px); max-height:none; padding:0; overflow:hidden; }
  .image-editor-dialog .ipe-header { padding:6px 14px; }
  .ipe-layout { display:grid; flex:1; min-height:0; grid-template-columns:minmax(0,1fr) minmax(230px,.8fr); overflow:hidden; }
  .ipe-workspace { padding:8px; min-height:0; }
  .ipe-stage { min-height:0; padding:5px; }
  #ipe-canvas { max-height:calc(100dvh - 190px); }
  .ipe-controls { display:block; overflow:auto; min-height:0; max-height:none; padding:0 14px 12px; }
  .ipe-footer { position:static; padding:6px 12px; flex-direction:row; }
}
