/* The opaque outer host stays full frame even when the native keyboard reduces
   only the panel. Preserve the document's 2px scroll workaround and Laptop split. */
html:is(.is-duo, .duo-device) #messageSheet.duo-sheet-frame,
html:is(.is-duo, .duo-device):not(.compose-laptop) #composeSheet.duo-sheet-frame {
  top: 0;
  bottom: auto;
  height: var(--duo-frame-height);
  background: var(--surface, #fff);
}
html.dark:is(.is-duo, .duo-device) #messageSheet.duo-sheet-frame,
html.dark:is(.is-duo, .duo-device):not(.compose-laptop) #composeSheet.duo-sheet-frame { background: var(--surface, #0f172a); }
html:is(.is-duo, .duo-device) #messageSheet.duo-sheet-frame > .panel,
html:is(.is-duo, .duo-device):not(.compose-laptop) #composeSheet.duo-sheet-frame > .panel {
  top: 0;
  bottom: auto;
  height: var(--duo-sheet-height);
  max-height: var(--duo-sheet-height);
  box-sizing: border-box;
}
/* Native outer geometry also supplies orientation while detector classes settle. */
html:is(.is-duo, .duo-device) #messageSheet.duo-sheet-frame[data-duo-sheet-orientation="portrait"] > .panel,
html:is(.is-duo, .duo-device):not(.compose-laptop) #composeSheet.duo-sheet-frame[data-duo-sheet-orientation="portrait"] > .panel { padding-top: 20px; }
html:is(.is-duo, .duo-device) #messageSheet.duo-sheet-frame[data-duo-sheet-orientation="portrait"] .m-head { padding-right: 144px; }
html:is(.is-duo, .duo-device):not(.compose-laptop) #composeSheet.duo-sheet-frame[data-duo-sheet-orientation="portrait"] .rcp-row[data-role="to"] { padding-right: 132px; }
/* Keep the home-indicator clearance without adding another 12–16px below it. */
html:is(.is-duo, .duo-device) #messageSheet.duo-sheet-frame #messageSheetActions,
html:is(.is-duo, .duo-device):not(.compose-laptop) #composeSheet.duo-sheet-frame #composeSheetActions { padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
/* Editor size follows the physical frame, with a smaller cap only when a real
   keyboard limits the panel. The body remains the scroller for fields/cards. */
html:is(.is-duo, .duo-device):not(.compose-laptop) #composeSheet.duo-sheet-frame .sheet-body { min-height: 0; overflow-y: auto; }
html:is(.is-duo, .duo-device):not(.compose-laptop) #composeSheet.duo-sheet-frame #cEditorWrap { flex: 0 0 auto; min-height: 0; }
html:is(.is-duo, .duo-device):not(.compose-laptop) #composeSheet.duo-sheet-frame #cEditor {
  flex: 0 0 auto;
  box-sizing: border-box;
  min-height: 100px;
  height: min(calc(var(--duo-frame-height) * .4), max(100px, calc(var(--duo-sheet-height) - 180px)));
  max-height: min(calc(var(--duo-frame-height) * .4), max(100px, calc(var(--duo-sheet-height) - 180px)));
  overflow-y: auto;
}
