/* The stepper and task-picker dialogs on a short screen. Their bodies were fixed heights (480, 418 and 500px),
   which with the title, toolbar and footer made a dialog 660-720px tall: on a laptop it ran off both ends
   of the screen. Each body now takes one of the heights below - its old height where the screen has room,
   otherwise what the screen leaves, so the grid inside scrolls and the dialog does not.

   296px is what a dialog holds around its body: up to 240px of title, toolbar, padding and footer, plus the
   library's 3.5rem of margin. The floor of 200px keeps a few rows on screen on a very short one (under
   about 500px), where the dialog then scrolls as a whole - see the rule under these.

   Both portals link this stylesheet from their host page; a new dialog body takes a variable from here
   rather than a height of its own. */
:root {
    --cos-step-body-fit: calc(100dvh - 296px);
    --cos-step-body-height: clamp(200px,var(--cos-step-body-fit), 480px);
    --cos-step-body-height-compact: clamp(200px,var(--cos-step-body-fit), 418px);
    --cos-step-body-height-tall: clamp(200px,var(--cos-step-body-fit), 500px);

    /* What a short screen has taken from a body: 0 where the body is its full height. In the tabbed step
       an empty grid's "no records" view sits a fixed distance down a grid that shares the body with the
       switcher and the toolbar; it gives this up first, so the view keeps fitting the grid and the grid
       does not scroll over nothing. */
    --cos-step-body-cut: calc(480px - var(--cos-step-body-height));
}

/* The library gives these dialogs the screen's height and centres their content in it, so content taller
   than the screen overflows both ways and its top cannot be scrolled to. As a minimum height the dialog is
   centred exactly as before while it fits, and grows - scrolling from its top - once it does not. */
.modal-dialog.il-stepper-modal,
.modal-dialog.il-import-contacts-dialog {
    height: auto;
    min-height: calc(100% - 3.5rem);
}

/* The library also holds these dialogs to at least 560px, which is taller than a short screen has once
   the body has shrunk. The floor gives way to the screen there and is the library's own everywhere else. */
.il-stepper-modal .modal-content,
.il-import-contacts-dialog .modal-content {
    min-height: min(560px, calc(100dvh - 3.5rem));
}
