/* ─── THE page button ───
   One definition for a button on a page: a toolbar, an action row, a card's own controls. The
   product had at least twelve - crd-btn, solt-btn, dash-ctl-btn, qtn-tool-btn, qic-bulk-btn,
   stk-cs-btn, rpm-btn, c360-dlb-btn, c360-rcf-btn, wh-layout-zoom-btn, tcd-component-btn,
   qtn-btn-move - plus one screen on raw Bootstrap. Same job, thirteen looks. Project owner,
   2026-09-11.

   `.c360-dlg-btn` in cim360-dialog.css is NOT this and stays separate: it is white-on-translucent
   because it sits on the dialog footer's blue gradient, and on a white page it would be invisible.
   A dialog footer and a page toolbar are genuinely different grounds - two definitions, both
   written down, rather than thirteen nobody chose.

   34px to match the dialog button, so a page and a dialog do not disagree about how tall a button
   is. Geometry a caller genuinely needs to change - an icon-only square, a full-width action -
   stays in the caller's own rule; the type, colour, radius and states come from here. */
.c360-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.125rem;
    padding: 0 0.875rem;
    border-radius: 0.5rem;
    border: 1px solid var(--cim360-border);
    background: var(--cim360-card);
    color: var(--cim360-text);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 140ms ease, border-color 140ms ease;
}

.c360-btn:hover:not(:disabled) {
    background: var(--cim360-surface-2);
    border-color: var(--cim360-border-strong);
}

.c360-btn:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--cim360-primary) 50%, transparent);
    outline-offset: 2px;
}

.c360-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.c360-btn.is-primary {
    background: var(--cim360-primary-surface);
    border-color: var(--cim360-primary);
    color: var(--cim360-text-inverse);
}

.c360-btn.is-primary:hover:not(:disabled) {
    background: color-mix(in srgb, var(--cim360-primary) 88%, black);
    border-color: var(--cim360-primary-dark);
}

/* Destructive is an outline that fills on hover, not a permanent red slab: a page can carry
   several buttons and one of them shouting changes what the screen looks like it is for. */
.c360-btn.is-danger {
    border-color: var(--cim360-danger-border);
    background: var(--cim360-danger-bg);
    color: var(--cim360-danger-fg);
}

.c360-btn.is-danger:hover:not(:disabled) {
    background: var(--cim360-danger);
    border-color: var(--cim360-danger);
    color: var(--cim360-text-inverse);
}

/* An icon-only button is square and loses the horizontal padding. It still needs an accessible
   name from the caller - aria-label or title - because there is no text to read. */
.c360-btn.is-icon {
    width: 2.125rem;
    padding: 0;
    gap: 0;
}

@media (prefers-reduced-motion: reduce) {
    .c360-btn { transition: none; }
}

.cim360-form-field {
    grid-column: span var(--field-span, 12);
}

/* 900px, not 768px. Every field collapsing to full width is the right behaviour, but the
   breakpoint sat below the 820px portrait-tablet width the DEV-16 AC targets, so at exactly
   the size that matters the fields stayed side by side. 900px matches SettingsLayout's own
   breakpoint, so the shell and the forms now change over together instead of leaving a band
   where one had reflowed and the other had not. DEV-278. */
@media (max-width: 900px) {
    .cim360-form-field {
        grid-column: span 12;
    }
}

/* ─── THE page form control. 38px, 8px, primary-tinted ───
   One definition for every control on a page form, whichever wrapper it sits in. There were four:
   this rule set the colours and no geometry, so a Warehouse or Company Defaults control fell back
   to whatever height DevExpress ships; `.inv-input` in app.css forced 38px/8px on Inventory
   Settings; `.settings-field input` in SettingsShell made User Preferences a 14px-radius pill
   about 48px tall on a grey surface; and a DevExpress editor on that same screen ignored it and
   came out a fifth way. Project owner, 2026-09-11: "control look and feel on user preferences and
   warehouse does not look the same as the rest of the system".

   A DIALOG control is deliberately different and stays so: `.c360-dlg-input`, 36px and 6px, on
   white. A dialog is a smaller, denser box than a settings page. Both are written down; four
   were not.

   Height on the wrapper AND on the inner input, because a DevExpress editor is a div around an
   input and sizing only the outer one leaves the text off-centre.

   `.c360-sp-btn` is Cim360SearchPicker's closed trigger, and it is here for the same reason the
   DevExpress editors are: it is a control on a page form and has to be the height of the ones
   beside it. Its own rule in cards/cim360-document-entry.css sets the DIALOG size, which is
   where most pickers live; this is what makes the nominal and tax code fields on a settings
   page grow to 38px like everything else on that page. Two sizes, each applied where it
   belongs - which is the whole point of this block.

   ─── The bare-control arm named a wrapper nothing renders ───
   `.settings-field` was the OLD wrapper. The six screens that used it moved onto Cim360FormField
   on 2026-09-11 and the class went with them - it now appears in no markup anywhere in the repo,
   only in these selectors. The `.dxbl-*` arms had `.cim360-form-field` added beside it and kept
   working; the arm covering a plain `<input>` or `<textarea>` never did, so it has been styling
   nothing since that day. That is why Profile, Global and Scanner Settings drew three browser
   default text boxes on a page whose every other control is 38px and tinted - the rule that was
   supposed to catch them was pointing at a class that had been deleted. All five `.settings-field`
   arms are gone rather than repaired: a dead selector in a shared rule is worse than no selector,
   because it reads as coverage.

   Two details in that arm carry the weight, and neither is decoration:

   `:where(...)` scores ZERO, so the whole selector weighs one element - less than any single class.
   It is a default a page can still override: the five Item card tabs each declare their own 36px
   field (`.plan-input`, `.log-input`, `.life-input`, `.fin-input`, `.bc-input`) and those keep
   winning, so this lands on the controls nobody styled and changes no screen that made a choice.
   Written as `.cim360-form-field-input input` it would have outscored all five and silently
   restyled four Item tabs on the way past.

   `>`, because a DevExpress editor IS a div wrapping its own `<input>`. A descendant selector
   would give that inner input a second 38px border and fill inside the wrapper's - a box drawn in
   a box. A bare control written by a page is a direct child of the field's input area; a
   DevExpress one never is.

   `.cim360-page-input` is the same control for a page that is NOT building a form field - a search
   box above a card list, a lone box on a toolbar. It joins the selector list rather than declaring
   its own copy, which is the whole point of this block: there is one page control, and a second
   place that needs it asks for it by name instead of restating it. */
.cim360-form-field .dxbl-text-edit,
.cim360-form-field .dxbl-combobox,
.cim360-form-field .dxbl-date-edit,
.cim360-form-field .dxbl-spin-edit,
.cim360-form-field .c360-sp-btn,
.cim360-page-input,
:where(.cim360-form-field-input) > input:not([type="checkbox"]):not([type="radio"]),
:where(.cim360-form-field-input) > .c360-alk > input,
:where(.cim360-form-field-input) > select,
:where(.cim360-form-field-input) > textarea {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    height: 2.375rem;
    min-height: 2.375rem;
    border-radius: 0.5rem;
    font-size: 0.8438rem;
    font-family: inherit;
    color: var(--cim360-text);
    background: var(--cim360-primary-field-bg);
    border: 1px solid var(--cim360-primary-field-border);
    --dxbl-edit-background-color: var(--cim360-primary-field-bg);
    --dxbl-edit-border-color: var(--cim360-primary-field-border);
}

/* The bare controls need their own padding; a DevExpress editor pads its inner input itself. */
.cim360-page-input,
:where(.cim360-form-field-input) > input:not([type="checkbox"]):not([type="radio"]),
:where(.cim360-form-field-input) > .c360-alk > input,
:where(.cim360-form-field-input) > select,
:where(.cim360-form-field-input) > textarea {
    padding: 0 0.75rem;
}

/* A textarea is the one control that is taller than a field, and it grows. */
:where(.cim360-form-field-input) > textarea {
    height: auto;
    min-height: 8.75rem;
    padding: 0.625rem 0.75rem;
    line-height: 1.45;
    resize: vertical;
}

.cim360-form-field .dxbl-text-edit:focus-within,
.cim360-form-field .dxbl-combobox:focus-within,
.cim360-form-field .dxbl-date-edit:focus-within,
.cim360-form-field .dxbl-spin-edit:focus-within,
.cim360-page-input:focus,
:where(.cim360-form-field-input) > input:focus,
:where(.cim360-form-field-input) > .c360-alk > input:focus,
:where(.cim360-form-field-input) > select:focus,
:where(.cim360-form-field-input) > textarea:focus {
    background: var(--cim360-card);
    border-color: var(--cim360-primary);
    outline: none;
    --dxbl-edit-background-color: var(--cim360-card);
    --dxbl-edit-border-color: var(--cim360-primary);
}

/* ─── An empty date field is blank, not a format mask ───
   An <input type="date"> with no value draws the browser's own mask - dd/mm/yyyy in Chromium
   and Safari, nothing at all in Firefox. On a form of mostly-optional dates that reads as a row
   of fields somebody has already filled in with something, and the one date that IS set is
   harder to pick out for it. Project owner, 2026-09-18.

   There is no `placeholder` on a date input to override, and no pseudo-class for "this one is
   empty". THE HOOK IS THE VALUE ATTRIBUTE: all 31 of these are rendered by Blazor from
   `Fmt.IsoDate`, which returns an empty string for a null date, so `value=""` is exactly "no
   date set" and Blazor rewrites it on every render. Nothing per-site has to be remembered,
   which is the point - a rule that needed a class on each input would be right on the fields
   somebody thought of and wrong on the next one written.

   Transparent text rather than `display: none` or `visibility: hidden`: the field keeps its
   height, its caret and its calendar button, and the browser's own picker still opens on click.
   The mask returns on focus, which is the moment somebody actually needs to know what shape the
   date takes - so nothing is hidden from the person typing, only from the person scanning.

   ::-webkit-datetime-edit is Chromium and Safari. Firefox already shows an empty date input as
   blank, so it needs no rule and gets none. */
input[type="date"][value=""]:not(:focus)::-webkit-datetime-edit {
    color: transparent;
}
