/* Office and Garage phone layout. Print documents retain their own paper geometry. */
.drawer-preferences,.topbar-workspace { display:none; }
@media screen {
  .phone-layout .portal-shell { min-width:0; }
  .phone-layout .content-area { grid-template-columns:minmax(0,1fr); gap:1rem; padding:.8rem max(.8rem,env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom)) max(.8rem,env(safe-area-inset-left)); }
  .phone-layout .content-area > *,.phone-layout .panel,.phone-layout .panel-header > * { min-width:0; max-width:100%; }
  .phone-layout .topbar { display:grid; grid-template-columns:44px minmax(0,1fr) 44px; align-items:center; gap:.35rem .55rem; min-height:0; padding:calc(.5rem + env(safe-area-inset-top)) max(.7rem,env(safe-area-inset-right)) .5rem max(.7rem,env(safe-area-inset-left)); }
  .phone-layout .topbar-menu { grid-column:1; grid-row:1; margin:0; }
  .phone-layout .topbar-title { grid-column:2; grid-row:1; text-align:left; }
  .phone-layout .topbar-title h1 { font-size:1.05rem; line-height:1.25; white-space:normal; overflow-wrap:anywhere; margin:0; }
  .phone-layout .topbar-title > p { display:none; }
  .phone-layout .topbar-workspace { display:block; font-size:.75rem; line-height:1.3; color:var(--ink-500); margin-top:.2rem; overflow-wrap:anywhere; }
  .phone-layout .topbar-controls { display:contents; }
  .phone-layout .topbar-controls > * { display:none; }
  .phone-layout .topbar-controls > .inbox-bell,.phone-layout .topbar-controls > #organisation-switcher { position:relative; z-index:1; }
  .phone-layout .topbar-controls > .inbox-bell { display:grid; grid-column:3; grid-row:1; width:44px; height:44px; }
  .phone-layout .topbar-controls > #organisation-switcher { display:block; grid-column:1/-1; grid-row:2; width:100%; max-width:100%; min-width:0; }
  .phone-layout .drawer { width:min(23rem,calc(100vw - 1rem)); max-height:100dvh; padding-bottom:calc(1rem + env(safe-area-inset-bottom)); }
  .phone-layout .drawer-brand { min-width:0; }
  .phone-layout .drawer-brand strong { white-space:normal; overflow-wrap:anywhere; }
  .phone-layout .drawer-link,.phone-layout .nav-fold-head,.phone-layout .portal-switch { min-height:44px; }
  .phone-layout .drawer-close { width:44px; height:44px; flex-shrink:0; }
  .phone-layout .drawer-preferences { display:grid; grid-template-columns:1fr 1fr; gap:.75rem; padding:.7rem 0; }
  .phone-layout .drawer-preference { display:flex; align-items:center; justify-content:space-between; gap:.5rem; font-size:.85rem; }
  .phone-layout .drawer-preference .theme-toggle { width:44px; height:44px; }
  .phone-layout .panel-header,.phone-layout .page-actions { flex-wrap:wrap; gap:.65rem; }
  .phone-layout .panel-header h2,.phone-layout .panel-header h3,.phone-layout .page-actions h2 { overflow-wrap:anywhere; }
  .phone-layout .page-actions { align-items:stretch; }
  .phone-layout .page-actions > form { width:100%; }
  .phone-layout .form-grid,.phone-layout .field-row,.phone-layout .filter-bar,.phone-layout .filter-grid { grid-template-columns:minmax(0,1fr); width:100%; }
  .phone-layout label,.phone-layout fieldset { min-width:0; }
  .phone-layout input:not([type="checkbox"]):not([type="radio"]),.phone-layout select,.phone-layout textarea { font-size:16px; max-width:100%; min-width:0; }
  .phone-layout input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),.phone-layout select { min-height:44px; }
  .phone-layout textarea { line-height:1.5; }
  .phone-layout input[type="checkbox"],.phone-layout input[type="radio"] { min-width:20px; min-height:20px; flex-shrink:0; }
  .phone-layout label:has(> input[type="checkbox"]),.phone-layout label:has(> input[type="radio"]) { min-height:44px; align-items:center; }
  .phone-layout .button,.phone-layout .text-button,.phone-layout .side-book,.phone-layout .side-done,.phone-layout .planner-details-button { min-height:44px; white-space:normal; overflow-wrap:anywhere; }
  .phone-layout .button { padding:.65rem .85rem; }
  .phone-layout .text-button { display:inline-flex; align-items:center; justify-content:center; }
  .phone-layout .action-row,.phone-layout .button-row,.phone-layout .pill-row,.phone-layout .inline-actions { flex-wrap:wrap; gap:.5rem; }
  .phone-layout .side-list .side-value { min-width:0; max-width:100%; white-space:normal; overflow-wrap:anywhere; }
  .phone-layout .side-list .side-name { overflow-wrap:anywhere; }
  .phone-layout .definition-grid dd,.phone-layout .stack-card dd,.phone-layout .table-subtext { overflow-wrap:anywhere; }
  .phone-layout .field-static,.phone-layout .field-static strong { min-width:0; overflow-wrap:anywhere; }
  .phone-layout .table-scroll { max-width:100%; min-width:0; }
  .phone-layout .mobile-record-table,.phone-layout .mobile-record-table tbody { display:block; width:100%; min-width:0; }
  .phone-layout .mobile-record-table caption { display:block; width:100%; }
  .phone-layout .mobile-record-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  .phone-layout .mobile-record-table tbody tr { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.7rem 1rem; padding:.85rem; margin:.6rem 0; background:var(--surface); border:1px solid var(--line); border-radius:12px; }
  .phone-layout .mobile-record-table tbody td,.phone-layout .mobile-record-table tbody th { display:block; min-width:0; width:auto; border:0; padding:0; background:none; white-space:normal; overflow-wrap:anywhere; text-align:left; font-size:.9rem; text-transform:none; letter-spacing:normal; }
  .phone-layout .mobile-record-table tbody td::before,.phone-layout .mobile-record-table tbody th::before { content:attr(data-mobile-label); display:block; margin-bottom:.25rem; font-size:.75rem; font-weight:650; color:var(--ink-500); }
  .phone-layout .mobile-record-table tbody tr > :first-child,.phone-layout .mobile-record-table tbody .mobile-record-full { grid-column:1/-1; }
  .phone-layout .mobile-record-table tbody tr > :first-child { padding-bottom:.5rem; border-bottom:1px solid var(--line); }
  .phone-layout .mobile-record-table tbody .mobile-record-full::before { display:none; }
  .phone-layout .mobile-record-table .button { margin:.2rem .25rem .2rem 0; }
  .phone-layout .record-pagination,.phone-layout .office-ux-pagination { display:grid; grid-template-columns:1fr auto auto; gap:.5rem; align-items:center; }
  .phone-layout .record-pagination > span,.phone-layout .office-ux-pagination > span { grid-column:1/-1; }
  .phone-layout :focus-visible { outline:2px solid var(--primary); outline-offset:3px; }
  .phone-layout :is(button,input,textarea,select,a,summary) { scroll-margin-block:calc(var(--portal-header-height,5rem) + .75rem) 1rem; }
  .phone-layout .secure-preview-card { width:100%; max-width:100%; max-height:100dvh; }
  .phone-layout .secure-preview-body { min-height:0; overflow:auto; }
  .phone-layout .toast-root { max-width:100%; right:max(.7rem,env(safe-area-inset-right)); left:max(.7rem,env(safe-area-inset-left)); bottom:calc(.8rem + env(safe-area-inset-bottom)); }
  .phone-layout .auth-page { display:flex; flex-direction:column; min-height:100dvh; }
  .phone-layout .auth-panel { padding:1.25rem; }
  .phone-layout .auth-visual { min-height:0; padding-bottom:1.2rem; }
  .phone-layout .auth-copy { display:none; }
  .phone-layout .auth-form { width:100%; margin:0; }
}
@media screen and (max-height:480px) {
  .phone-layout .topbar { position:relative; }
}
