/* PDF Studio mobile layout (applied when body.mobile) */
body.mobile { font-size: 14px; }
body.mobile button { min-height: 36px; }
/* top bar */
#mtop { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: var(--bg2); border-bottom: 1px solid var(--border); padding-top: max(6px, env(safe-area-inset-top)); }
#mtop button { background: transparent; border: none; font-size: 20px; width: 40px; height: 40px; padding: 0; }
#mtop button.primary { width: auto; font-size: 14px; padding: 0 12px; background: var(--accent); border-radius: 6px; }
#mtop #mtitle { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
/* toolbars become horizontal scrollers with big targets */
body.mobile #toolbar, body.mobile #toolbar2 { overflow-x: auto; overflow-y: hidden; flex-wrap: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
body.mobile #toolbar::-webkit-scrollbar, body.mobile #toolbar2::-webkit-scrollbar { display: none; }
body.mobile #toolbar .tb-group { flex-shrink: 0; }
body.mobile .tb-btn { width: 42px; height: 42px; }
body.mobile .tb-btn svg { width: 24px; height: 24px; }
body.mobile .tb-spacer { display: none; }
body.mobile #props-inline { flex-shrink: 0; }
body.mobile #toolbar2 { padding: 4px 6px; }
body.mobile button.tb2 { flex-shrink: 0; padding: 8px 12px; font-size: 13px; }
body.mobile .tb2-label { display: none; }
body.mobile #toolbar .tb-btn[data-cmd="open"], body.mobile #toolbar .tb-btn[data-cmd="save"], body.mobile #toolbar .tb-btn[data-cmd="print"], body.mobile #toolbar .tb-btn[data-cmd="undo"], body.mobile #toolbar .tb-btn[data-cmd="redo"] { display: none; }
/* sidebar & properties become drawers */
body.mobile #sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(85vw, 320px); z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.5); }
body.mobile #propspanel { position: fixed; right: 0; top: 0; bottom: 0; width: min(85vw, 300px); z-index: 60; transform: translateX(100%); transition: transform .2s; box-shadow: -4px 0 20px rgba(0,0,0,.5); }
body.mobile #sidebar.collapsed, body.mobile #propspanel.collapsed { display: flex; }
body.mobile.drawer-side #sidebar { transform: none; }
body.mobile.drawer-props #propspanel { transform: none; }
#mscrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
body.mobile.drawer-open #mscrim { display: block; }
body.mobile .side-tab { font-size: 12px; padding: 10px 2px; }
body.mobile .thumb canvas { width: 120px !important; height: auto !important; }
/* viewer */
body.mobile #viewer { padding: 8px; }
body.mobile .page { margin-bottom: 10px; }
body.mobile #statusbar { padding: 4px 8px; padding-bottom: max(4px, env(safe-area-inset-bottom)); }
body.mobile #status-file { display: none; }
body.mobile #statusbar button { min-height: 32px; padding: 2px 10px; }
/* modals */
body.mobile .modal-box { min-width: 0 !important; width: 96vw; max-height: 92vh; }
body.mobile .form-row { flex-wrap: wrap; }
body.mobile .form-row label:first-child { width: 100%; }
body.mobile .form-row input[type=text], body.mobile .form-row input[type=password], body.mobile .form-row select, body.mobile .form-row textarea { width: 100%; min-height: 36px; }
body.mobile .sigpad { width: 100%; height: 160px; }
body.mobile .cmp-row { flex-direction: column; }
body.mobile .popover { width: min(92vw, 320px); }
body.mobile .welcome-card { min-width: 0; width: 92vw; padding: 24px 16px; }
body.mobile .welcome-actions { flex-wrap: wrap; }
body.mobile .recent-grid { grid-template-columns: repeat(2, 1fr); }
.recent-del { font-size: 11px; }
/* app menu */
.mmenu-group { margin-bottom: 8px; }
.mmenu-item { display: block; width: 100%; text-align: left; background: none; border: none; padding: 9px 8px; font-size: 14px; border-bottom: 1px solid #3a3a3a; }
.mmenu-item:active { background: #454545; }
/* tabs */
body.mobile .tab { max-width: 160px; }
/* list rows (recovery, attachments, etc.) wrap their action links on narrow screens */
body.mobile .list-item > div[style*="space-between"] { flex-wrap: wrap; gap: 4px; }
body.mobile .list-item button.link { white-space: nowrap; }
/* a touch that starts on an annotation or handle is always a drag, never a scroll */
body.mobile .page svg.annots .ann, body.mobile .page svg.annots .handle { touch-action: none; }
/* plain browser on a desktop screen: normal layout, only the top bar with the menu is added */
body.webtop #mtop { padding: 4px 8px; }
body.webtop #mtop button { width: 34px; height: 34px; font-size: 18px; }
body.webtop #mtop button.primary { width: auto; font-size: 13px; padding: 0 12px; }
body.webtop #mtop #mtitle { font-size: 13px; }
body.webtop .tb-btn[data-cmd="create-office"], body.webtop .tb-btn[data-cmd="create-web"] { display: none; }
