// Optional NumberInput controls. Plain masked text fields retain their styling.
.number-input-stepper {
  display: grid;
  grid-template-columns: 40px 40px minmax(60px, 1fr) 40px 40px;
  align-items: stretch;
  max-width: 100%;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 16px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  overflow: hidden;
  &:focus-within { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }
  > input[type='text']:not(.browser-default),
  > input[type='text']:not(.browser-default):focus:not([readonly]) {
    width: 100%;
    min-width: 0;
    height: 56px;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    outline: 0;
    box-shadow: none;
    padding: 0 4px;
    margin: 0;
    background: transparent;
    color: inherit;
    text-align: center;
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
  }
  > button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-height: 56px;
    border: 0;
    border-radius: 0;
    padding: 4px;
    // Fine adjustments use a lighter tint; coarse adjustments use the full container.
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 55%, var(--md-sys-color-surface));
    color: var(--md-sys-color-on-primary-container);
    cursor: pointer;
    > span { font-size: 28px; line-height: 1; }
    > small { font-size: 11px; line-height: 1.2; }
    &[data-large='true'] { background: var(--md-sys-color-primary-container); }
    &:hover:not(:disabled) { background: color-mix(in srgb, var(--md-sys-color-primary) 12%, var(--md-sys-color-primary-container)); }
    &:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: -3px; }
    &:disabled { opacity: .38; cursor: default; }
  }
}

// Match the text-field silhouettes without changing existing rounded steppers.
.number-input-stepper:has(> input[data-number-variant='outlined']) {
  border-radius: 4px;
  &:focus-within {
    outline: none;
    border-color: var(--md-sys-color-primary);
    box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
  }
}
.number-input-stepper:has(> input[data-number-variant='filled']) {
  border: 0;
  border-bottom: 1px solid var(--md-sys-color-on-surface-variant);
  border-radius: 4px 4px 0 0;
  background: var(--md-sys-color-surface-container-highest, var(--md-sys-color-surface-variant));
  &:focus-within {
    outline: none;
    border-bottom-color: var(--md-sys-color-primary);
    box-shadow: 0 1px 0 0 var(--md-sys-color-primary);
  }
}

// A stepped field uses a label above the whole control, clear of all four arrows.
.input-field:has(> .number-input-stepper) {
  > label {
    position: static;
    display: block;
    transform: none;
    font-size: 12px;
    margin-bottom: 4px;
  }
  &:focus-within > label { color: var(--md-sys-color-primary); }
}
