/* Weight dialog capture area. Only layout and size; colors and type come from the app utilities. */
.weight-capture[data-method="scale"] { display: flex; flex-direction: column; }
/* The reading sits just under its label; any spare height goes before the actions. */
.weight-capture-display { display: flex; flex: 1; align-items: flex-start; min-height: 3.5rem; padding-top: .25rem; }
@media (min-width: 48rem) {
  /* Same height for scale and manual entry, so the centered dialog keeps its confirm button in place. */
  .weight-capture:not([data-method="amount"]) { min-height: 13rem; }
  .weight-capture-display { min-height: 4.5rem; }
  .weight-capture-display .text-4xl { font-size: 2.5rem; }
}

/* Landscape tablets lose substantial height to Chrome tabs and system bars.
   Keep capture and total side by side, with the primary action always outside
   the scroll area. Do not shrink text or touch targets to make the form fit. */
@media (min-width: 48rem) and (max-height: 44rem) {
  .weight-dialog {
    width: min(48rem, calc(100vw - 2rem));
    max-width: 48rem;
    max-height: calc(100dvh - 1.5rem);
    padding: 1rem 1.5rem;
  }
  .weight-dialog > div[aria-hidden="true"] { display: none; }
  .weight-form {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    grid-template-areas: "price price" "method summary" "capture summary";
    column-gap: 1.5rem;
    padding-bottom: .25rem;
  }
  .weight-price { grid-area: price; margin-bottom: .25rem; }
  .weight-method { grid-area: method; margin-bottom: .25rem; }
  .weight-capture { grid-area: capture; min-width: 0; }
  .weight-form > [role="alert"] { grid-column: 1 / -1; }
  .weight-summary { grid-area: summary; align-self: start; margin-top: 0; }
  .weight-capture:not([data-method="amount"]) { min-height: 0; }
  .weight-capture[data-method="scale"] > div:first-child { min-height: 1.5rem; }
  .weight-capture-display { flex: none; min-height: 0; padding-top: .5rem; }
  .weight-capture-display + div { margin-top: .5rem; }
  .weight-capture > .mb-5 { margin-bottom: .5rem; }
  .weight-capture[data-method="manual"] {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .5rem;
    align-items: end;
  }
  .weight-capture[data-method="manual"] > div:first-child { display: contents; }
  .weight-capture[data-method="manual"] > div:first-child > * { margin: 0; }
  .weight-capture[data-method="manual"] > div:first-child > div:first-child { grid-column: 1 / -1; }
  .weight-capture[data-method="manual"] > div:last-child { margin-top: 0; }
  .weight-capture[data-method="manual"] > div:last-child button { margin-inline-start: 0; }
  .weight-footer { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
  .weight-footer > button:last-child { width: auto; min-width: 7rem; padding-inline: 1rem; }
}
