/* Everflow mobile editor shell — final overrides after calm-ui.
   Keep mm-sized physical paper unchanged; change chrome and drawer only. */
body.editor-page #textPdfButton,
body.editor-page #mobileTextDownloadButton{display:none!important}
body.editor-page #textPdfButton[hidden],
body.editor-page #mobileTextDownloadButton[hidden]{display:none!important}
body.editor-page #browserPrintButton{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  gap:6px!important;white-space:nowrap!important;writing-mode:horizontal-tb!important;
  font-weight:500!important;min-width:86px!important;
  background:#fff!important;color:#2e554c!important;border:1px solid #d7e4de!important;
  border-radius:7px!important;height:32px!important;min-height:32px!important
}
body.editor-page #browserPrintButton .ef-icon,
body.editor-page #mobileSystemPrintButton .ef-icon{width:16px!important;height:16px!important;flex:0 0 16px!important}
body.editor-page #printButton{white-space:nowrap!important;min-width:102px!important}
body.editor-page #mobileSystemPrintButton{display:none!important}

/* Tablet/desktop: a single visible PDF download and a distinct system print button. */
@media(min-width:768px){
 body.editor-page #mobileDownloadButton,
 body.editor-page #mobileSystemPrintButton,
 body.editor-page #mobileTextDownloadButton{display:none!important}
 body.editor-page #previewPane .preview-toolbar-right{display:flex!important;align-items:center!important;gap:7px!important}
 body.editor-page #previewPane .preview-toolbar-right #browserPrintButton{display:inline-flex!important}
}

@media(max-width:767px){
 body.editor-page{
  --everflow-mobile-header:102px;
  width:100%!important;max-width:100vw!important;overflow:hidden!important
 }
 body.editor-page .texpage-topbar{
  position:relative!important;z-index:101!important;
  display:block!important;
  height:var(--everflow-mobile-header)!important;
  min-height:var(--everflow-mobile-header)!important;
  max-height:var(--everflow-mobile-header)!important;
  padding:8px 10px!important;box-sizing:border-box!important;
  border-bottom:1px solid #dbe4e0!important;overflow:visible!important
 }
 /* Avoid duplicate branding inside the tiny phone toolbar. */
 body.editor-page .texpage-topbar .editor-brand-wrap{display:none!important}
 body.editor-page .texpage-topbar .editor-top-actions{
  display:grid!important;
  grid-template-columns:repeat(12,minmax(0,1fr))!important;
  grid-template-rows:38px 40px!important;
  align-content:center!important;align-items:center!important;
  width:100%!important;max-width:100%!important;min-width:0!important;
  height:100%!important;margin:0!important;padding:0!important;gap:6px!important;
  overflow:visible!important;justify-content:stretch!important;
 }
 body.editor-page .texpage-topbar .history-actions,
 body.editor-page .texpage-topbar .save-state,
 body.editor-page .texpage-topbar .local-pill{display:none!important}
 body.editor-page .texpage-topbar .navigator-toggle{
  grid-column:1 / 3!important;grid-row:1!important;
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  width:100%!important;min-width:0!important;max-width:none!important;
  height:38px!important;min-height:38px!important;padding:0!important
 }
 body.editor-page .texpage-topbar .template-control{
  grid-column:3 / 11!important;grid-row:1!important;
  display:block!important;min-width:0!important;max-width:none!important;width:100%!important;
  height:38px!important;margin:0!important;order:initial!important
 }
 body.editor-page .texpage-topbar #templateButton{
  display:flex!important;align-items:center!important;justify-content:space-between!important;
  width:100%!important;max-width:none!important;min-width:0!important;
  height:38px!important;min-height:38px!important;margin:0!important;padding:0 11px!important;
 }
 body.editor-page .texpage-topbar #templateButtonLabel{
  display:block!important;min-width:0!important;max-width:calc(100% - 24px)!important;
  white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;
  font-size:13px!important;line-height:1.1!important
 }
 body.editor-page .texpage-topbar .editor-more-menu{
  grid-column:11 / 13!important;grid-row:1!important;min-width:0!important;
  display:flex!important;align-items:center!important;justify-content:center!important;
  position:relative!important;height:38px!important;width:100%!important;margin:0!important;
 }
 body.editor-page .texpage-topbar .editor-more-menu>summary{
  display:flex!important;align-items:center!important;justify-content:center!important;
  width:100%!important;height:38px!important;min-height:38px!important;
  font-size:19px!important;border:1px solid #dce5e1!important;border-radius:8px!important;
 }
 body.editor-page .texpage-topbar .editor-more-popover{
  top:42px!important;right:0!important;left:auto!important;
  width:min(250px,calc(100vw - 24px))!important;max-height:min(70dvh,430px)!important;
  overflow-y:auto!important;z-index:400!important
 }
 body.editor-page .texpage-topbar #mobileDownloadButton{
  grid-column:1 / 5!important;grid-row:2!important;
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  width:100%!important;min-width:0!important;max-width:none!important;
  height:40px!important;min-height:40px!important;
  padding:0 4px!important;gap:5px!important;
  font-size:12px!important;font-weight:600!important;white-space:nowrap!important
 }
 body.editor-page .texpage-topbar #mobileSystemPrintButton{
  grid-column:5 / 8!important;grid-row:2!important;
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  width:100%!important;min-width:0!important;max-width:none!important;
  height:40px!important;min-height:40px!important;
  background:#f8faf9!important;color:#34584b!important;
  border:1px solid #d9e5df!important;border-radius:8px!important;
  padding:0 4px!important;gap:4px!important;
  font-size:12px!important;font-weight:500!important;white-space:nowrap!important
 }
 body.editor-page .texpage-topbar .mobile-mode-switch{
  grid-column:8 / 13!important;grid-row:2!important;
  display:flex!important;align-items:center!important;justify-content:stretch!important;
  width:100%!important;min-width:0!important;max-width:none!important;
  height:40px!important;min-height:40px!important;
  box-sizing:border-box!important;flex:none!important;margin:0!important;
  padding:3px!important;border-radius:8px!important;overflow:hidden!important
 }
 body.editor-page .texpage-topbar .mobile-mode-switch button{
  display:inline-flex!important;align-items:center!important;justify-content:center!important;
  flex:1 1 0!important;width:auto!important;min-width:0!important;max-width:none!important;
  height:32px!important;min-height:32px!important;padding:0 3px!important;
  font-size:12px!important;line-height:1!important;white-space:nowrap!important
 }
 body.editor-page .texpage-topbar .template-popover{
  top:43px!important;left:0!important;right:auto!important;
  width:min(320px,calc(100vw - 20px))!important;max-width:calc(100vw - 20px)!important;
  max-height:calc(100dvh - var(--everflow-mobile-header) - 10px)!important;
  overflow-y:auto!important;z-index:300!important
 }
 body.editor-page .texpage-workbench{
  display:block!important;height:calc(100dvh - var(--everflow-mobile-header))!important;
  max-height:calc(100dvh - var(--everflow-mobile-header))!important;
  width:100%!important;overflow:hidden!important
 }
 body.editor-page .texpage-navigator{
  position:fixed!important;top:var(--everflow-mobile-header)!important;bottom:0!important;
  left:0!important;z-index:90!important;
  width:min(100vw,430px)!important;max-width:100vw!important;
  height:calc(100dvh - var(--everflow-mobile-header))!important;
  max-height:calc(100dvh - var(--everflow-mobile-header))!important;
  overflow:hidden!important;box-shadow:12px 0 30px #1b3b3529!important;
  transform:translateX(-105%)!important;transition:transform .19s ease!important
 }
 body.editor-page.navigator-open .texpage-navigator{transform:translateX(0)!important}
 body.editor-page .workbench-backdrop{
  position:fixed!important;inset:var(--everflow-mobile-header) 0 0!important;
  z-index:85!important
 }
 body.editor-page.navigator-open .workbench-backdrop{display:block!important}
 body.editor-page #navigatorPanel .navigator-head{flex:0 0 auto!important;height:59px!important}
 body.editor-page #navigatorPanel .navigator-tabs{flex:0 0 auto!important}
 body.editor-page #navigatorPanel #outlinePanel{min-height:0!important;overflow:auto!important}
 body.editor-page #navigatorPanel .outline-tree-title,
 body.editor-page #navigatorPanel .order-copy b{
  white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important
 }
 body.editor-page .texpage-editor-pane,
 body.editor-page .texpage-preview-pane{
  height:100%!important;max-height:100%!important;min-height:0!important;width:100%!important
 }
 body.editor-page .navigator-resizer,
 body.editor-page .preview-resizer{display:none!important}
 body.editor-page #previewPane .preview-toolbar-right,
 body.editor-page #previewPane .preview-toolbar-right #printButton,
 body.editor-page #previewPane .preview-toolbar-right #browserPrintButton{display:none!important}
 /* A compact in-pane toolbar: page navigation + toggles, no duplicate downloads. */
 body.editor-page #previewPane#previewPane .preview-toolbar{
  display:flex!important;align-items:center!important;justify-content:space-between!important;
  flex-wrap:wrap!important;height:auto!important;min-height:46px!important;
  padding:6px 9px!important;gap:5px!important
 }
 body.editor-page #previewPane#previewPane .preview-toolbar-center{
  display:flex!important;position:static!important;left:auto!important;bottom:auto!important;
  transform:none!important;flex:1 1 185px!important;width:auto!important;min-width:0!important;
  max-width:none!important;padding:0!important;margin:0!important;
  border:0!important;box-shadow:none!important;border-radius:0!important;
  align-items:center!important;justify-content:flex-start!important
 }
 body.editor-page #previewPane#previewPane .preview-toolbar-extra{
  display:flex!important;align-items:center!important;justify-content:flex-end!important;
  flex:0 1 auto!important;min-width:0!important;gap:7px!important;margin:0!important
 }
 body.editor-page #previewPane .preview-toolbar-extra label{white-space:nowrap!important}
 body.editor-page #previewPane .preview-toolbar-left{display:none!important}
 body.editor-page #previewPane .pdf-status{padding:5px 9px!important;font-size:11px!important;line-height:1.4!important}
 body.editor-page #previewPane .browser-paper-preview{
  flex:1 1 auto!important;min-height:0!important;width:100%!important;
  padding:11px 6px calc(30px + env(safe-area-inset-bottom))!important;overflow:auto!important
 }
 body.editor-page #editPane .editor-question-nav{max-width:100%!important}
 body.editor-page #editPane .texpage-question-editor{max-height:none!important}
}
@media(max-width:359px){
 body.editor-page .texpage-topbar{padding:8px 6px!important}
 body.editor-page .texpage-topbar .editor-top-actions{gap:4px!important}
 body.editor-page .texpage-topbar #mobileDownloadButton,
 body.editor-page .texpage-topbar #mobileSystemPrintButton{font-size:11px!important;gap:3px!important}
 body.editor-page .texpage-topbar .mobile-mode-switch button{font-size:11px!important}
 body.editor-page #previewPane#previewPane .preview-toolbar-center .fit-btn{display:none!important}
}

/* Printing uses existing, physically sized pages without preview zoom or UI. */
@media print{
 html,body.editor-page{margin:0!important;padding:0!important;width:auto!important;height:auto!important;overflow:visible!important}
 body.editor-page.browser-print-active .texpage-workbench,
 body.editor-page.browser-print-active #previewPane{position:static!important;display:block!important;width:auto!important;height:auto!important;max-height:none!important;overflow:visible!important}
 body.editor-page.browser-print-active #typstPreview{
  position:static!important;display:block!important;width:auto!important;height:auto!important;
  max-height:none!important;min-height:0!important;overflow:visible!important;
  margin:0!important;padding:0!important;background:#fff!important
 }
 body.editor-page.browser-print-active #typstPreview>.browser-paper-page{
  display:block!important;zoom:1!important;transform:none!important;
  margin:0!important;border:0!important;box-shadow:none!important;border-radius:0!important;
  break-after:page!important;page-break-after:always!important
 }
 body.editor-page.browser-print-active #typstPreview>.browser-paper-page:last-child{
  break-after:auto!important;page-break-after:auto!important
 }
 body.editor-page.browser-print-active #typstPreview .browser-gap-handle{display:none!important}
}