/* Sales entry form (v2) - item cards. Prototype styles; fold into the main SCSS once signed off.
   Layout: one field per line (label left, input right). Dependent fields share
   their parent's line via .c-entry-item__pair (built by entry-form-items.js). */

.c-entry-items {
    --entry-label-w: 230px;
    --entry-gap: 16px;
    margin: 0 0 16px;
}

.c-entry-item {
    margin: 0 0 16px;
    padding: 14px 20px 16px;
    border: 1px solid #d6d6d6;
    background: #fafafa;
}

.c-entry-item__title {
    margin: 0 0 12px;
    padding: 0 0 8px;
    border-bottom: 1px solid #e3e3e3;
}

/* Single field line: label | input */
.c-entry-item .c-dynform__form-item {
    display: grid;
    grid-template-columns: var(--entry-label-w) minmax(0, 1fr);
    gap: 0 var(--entry-gap);
    align-items: center;
    float: none;
    width: auto;
    margin: 0 0 8px;
    padding: 0;
}

.c-entry-item .c-dynform__form-label {
    display: block;
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    text-align: left;
    line-height: 1.3;
}

/* Inputs: full width of their column, a little tighter than the site default */
.c-entry-item input.text,
.c-entry-item textarea,
.c-entry-item select {
    display: block;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
    padding: 9px 12px 8px;
}

.c-entry-item .select {
    width: 100%;
    float: none;
}

.c-entry-item select,
.c-entry-item .select select {
    padding-right: 36px;
    background-color: #fff;
}

/* Dropdowns are half the input column on every line, so a dropdown on its
   own lines up with one that has a "please specify" box beside it. */
.c-entry-item .c-dynform__form-item > select,
.c-entry-item .c-dynform__form-item > .select {
    width: calc(50% - var(--entry-gap) / 2);
}

.c-entry-item .c-entry-item__pair > .c-dynform__form-item > select,
.c-entry-item .c-entry-item__pair > .c-dynform__form-item > .select {
    width: 100%;
}

/* Textarea line: label aligned to the top */
.c-entry-item .c-dynform__form-item.c-entry-item__full {
    align-items: start;
}

.c-entry-item .c-entry-item__full .c-dynform__form-label {
    padding-top: 9px;
}

.c-entry-item textarea {
    min-height: 64px;
}

/* Paired line: label | main input | dependent input */
.c-entry-item__pair {
    display: grid;
    grid-template-columns: var(--entry-label-w) minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 var(--entry-gap);
    align-items: center;
    margin: 0 0 8px;
}

.c-entry-item .c-entry-item__pair > .c-dynform__form-item {
    display: contents;
}

/* The dependent field's label is kept for screen readers only;
   its placeholder carries the prompt visually. */
.c-entry-item .c-entry-item__dep .c-dynform__form-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* Checkbox (V5): remove the site's checklist spacing so the line matches the others */
.c-entry-item .c-dynform__form-item-options,
.c-entry-item .c-dynform__form-item-options .chk {
    margin: 0;
    padding: 0;
}

.c-entry-item .is-invalid {
    border-color: #c00;
}

.c-entry-item__error {
    display: block;
    margin-top: 4px;
    color: #c00;
    font-size: 0.9em;
}

.c-entry-item__pair > .c-entry-item__error {
    grid-column: 3;
}

.c-entry-items__actions .btn {
    margin: 0 8px 8px 0;
}

/* Mobile: label above input; paired inputs stay side by side */
@media (max-width: 600px) {
    .c-entry-item {
        padding: 12px 14px 14px;
    }

    .c-entry-item .c-dynform__form-item {
        grid-template-columns: minmax(0, 1fr);
    }

    .c-entry-item .c-dynform__form-label {
        margin-bottom: 4px;
    }

    .c-entry-item__pair {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0 10px;
    }

    .c-entry-item__pair > .c-dynform__form-item:first-child > .c-dynform__form-label {
        grid-column: 1 / -1;
    }

    .c-entry-item__pair > .c-entry-item__error {
        grid-column: 2;
    }
}
