/* The a08 mode's page-side styles (canvas-adapter/r6/modes/a08.js), as d01.css. The component styles itself under
   .gc-d01.gc-a08 (/geo-canvas/r1/geo-canvas-a08.css); this file only lets the canvas surface grow to the component's
   height, because the stage, borehole and section cards sit under the views. It is loaded on the A08 page only, so the
   page-side rules below (fix r3, ux r2) change no other calculator. */
.cv-surface .gc-a08 { min-height: 520px; }

/* fix r3 (ux r2 P2-5): a cleared or invalid grid cell is marked where it is, not only by aria-invalid (the grid's cells
   have no border of their own, so the page's red border colour drew nothing). */
.grid-in td input[aria-invalid="true"],
.grid-in td .grid-slider-popover-trigger[aria-invalid="true"] {
    outline: 2px solid var(--required-ink, #b42318); outline-offset: -2px;
    background: color-mix(in srgb, var(--required-ink, #b42318) 7%, var(--surface, #fff));
}

/* fix r3 (ux r2 P2-5): a flagged grid's "Go to the cell" button under its message (composition/app.js draws it on
   this page only), small and outlined in the message's colour. */
.required-field-error > .grid-flag-jump {
    justify-self: start; margin-top: 4px; padding: 3px 10px; border: 1px solid currentColor; border-radius: 6px;
    background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer;
}
.required-field-error > .grid-flag-jump:focus-visible { outline: 2px solid var(--accent, #4f46e5); outline-offset: 2px; }

/* fix r3 (ux r2 P3): the rate value boxes take the field's whole width, so 100,001.00 and its unit fit (the box was a
   fixed 152 px and clipped six-figure values). */
.slider-value-row > .slider-entry-formatted:has(input[id^="in_rate_"][id$="-entry"]) { width: 100%; max-width: 100%; flex: 1 1 auto; }

/* add-rows (Ugur 2026-11-21) replacing fix r3 (ux r2 P2-11): on a phone each A08 input grid row is a labeled card, the
   dense grid standard's phone layout (DENSE_GRID_CONTROL_STANDARD.md: "At 900 px and below, each matrix row becomes a
   labeled card"), the same rules site.css gives a wider pop-up table. The three grids are pop-up tables of four drawn
   columns or fewer, which the platform keeps as a table at every width (grid-popover-compact); with the Add/Remove
   rows' action column, four text columns or a soil name such as "Dense sand and gravel" no longer fit a 375 px table.
   This sheet loads on the A08 page only, so no other page changes. Every value takes the card's width and every
   control stays at least 44 px tall; the submitted matrix is unchanged. */
@media (max-width: 600px) {
    body .template-workspace .field .grid-in.grid-popover-compact { display: block; width: 100%; min-width: 0; max-width: 100%; }
    .grid-in.grid-popover-compact colgroup { display: none; }
    .grid-in.grid-popover-compact thead {
        position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
        overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }
    .grid-in.grid-popover-compact tbody { display: grid; gap: 12px; width: 100%; }
    .grid-in.grid-popover-compact tbody tr {
        display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; width: 100%; box-sizing: border-box;
        padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
    }
    body .template-workspace .field .grid-in.grid-popover-compact tbody td {
        display: grid; grid-template-columns: minmax(96px, 36%) minmax(0, 1fr);
        align-items: center; gap: 10px; width: 100% !important; min-width: 0; max-width: none; min-height: 44px;
        box-sizing: border-box; padding: 5px 6px; border: 0; text-align: left;
    }
    .grid-in.grid-popover-compact tbody td::before {
        content: attr(data-column-label); color: var(--muted); font-size: .7rem;
        font-weight: 700; line-height: 1.2; overflow-wrap: anywhere;
    }
    .grid-in.grid-popover-compact tbody td > input:not([type="checkbox"]),
    .grid-in.grid-popover-compact tbody td > select,
    .grid-in.grid-popover-compact .grid-slider-popover-control,
    .grid-in.grid-popover-compact .grid-slider-popover-trigger,
    .grid-in.grid-popover-compact .grid-cell-value { width: 100%; min-width: 0; min-height: 44px; text-align: left; }
    .grid-in.grid-popover-compact .grid-slider-popover-trigger {
        border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: var(--surface-soft);
    }
    /* The row's Remove sits at the card's end, a 44 px touch target. */
    body .template-workspace .field .grid-in.grid-popover-compact tbody td.grid-action-cell { grid-template-columns: minmax(0, 1fr); justify-items: end; }
    .grid-in.grid-popover-compact tbody td.grid-action-cell::before { content: none; }
    .grid-in.grid-popover-compact .grid-remove { min-height: 44px; padding: 0 14px; }
}

/* fix r3 (ux r2 P3, "the sticky Calculate bar is 16 % of a 375 px viewport"): on a phone the button and its status
   line share one row, with tighter padding, so the bar is about half as tall. */
@media (max-width: 640px) {
    div.cv-actions { flex-wrap: nowrap; gap: 10px; padding: 8px 12px; }
    div.cv-actions > .cv-calculate { flex: 0 0 auto; min-height: 40px; padding: 0 16px; }
    div.cv-actions > .cv-status { flex: 1 1 auto; min-width: 0; font-size: .78rem; line-height: 1.3; }
}
