/**
 * aqua-layout.css -- one grid and one set of form sizes for every page.
 *
 * Loaded after aqua-motion.css. Where pages drew their own grids, a row of
 * cards that did not divide evenly left a card alone on the next line, and
 * form fields were different heights side by side. These rules make rows fit
 * their content and fields share a height, and they change nothing else.
 */

/* Rows of summary cards (payroll totals and similar): fit as many as the
   width allows, instead of a fixed number of columns that leaves a gap. */
.form-group-row.mb-20 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    align-items: stretch;
}

/* Four summary cards sit in one row when the page has the room. */
@media (min-width: 1100px) {
    .form-group-row.mb-20:has(> :nth-child(4)) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* Form fields in a row share one height, border and corner radius. */
.form-group-row input:not([type="checkbox"]):not([type="radio"]),
.form-group-row select,
.form-group-row textarea,
.table-controls input:not([type="checkbox"]):not([type="radio"]),
.table-controls select {
    min-height: 42px;
    box-sizing: border-box;
    border-radius: 12px;
}

/* Two columns that should start level: each card keeps its own height. */
.attendance-grid.two-col {
    align-items: start;
}

/* Map panels in cards fill the card and keep a fixed height. */
.attendance-card .map-shell,
.attendance-card .leaflet-container {
    width: 100%;
    min-height: 320px;
}

/* Page headers and the content under them keep one rhythm. */
#app-content > .page-header,
#app-content > [id$="Header"] {
    margin-bottom: 18px;
}

/* Cards in a grid stretch to the row's height. Their own content sets the
   height: a card taller than its neighbour grows the row, rather than being
   pinned to the neighbour's height and spilling over whatever sits below. */
.attendance-grid > .attendance-card,
.dashboard-dual-grid > .content-card {
    height: auto;
    align-self: stretch;
}

/* Long words and long names wrap instead of pushing a card wider. */
.content-card, .attendance-card, .dashboard-stat-card {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 640px) {
    .form-group-row.mb-20 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
