/* CoreMatchFieldContract/v1
   Compact read-first rows for frontend and workspace forms. Only forms marked
   data-corematch-field-contract opt into the click-to-edit behavior. */

/* Auth consumes the same read-first controls; autocomplete keeps its own
   accessible listbox controller and uses the same underline-only treatment. */
.cm-field-contract .cm-field-label {
    position: relative;
    padding-inline-start: 27px !important;
    min-width: 0;
}
.cm-field-contract .cm-field-label > .cm-field-icon {
    position: absolute;
    inset-inline-start: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.cm-field-contract .signup-bio-tip > summary > .cm-nav-icon {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.auth-form.cm-field-contract label { color: var(--cm-color-text); }
.auth-form.cm-field-contract .auth-field-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
}
.auth-form.cm-field-contract .auth-field-grid > label {
    display: grid;
    grid-template-columns: minmax(100px, 35%) minmax(0, 1fr);
    align-items: center;
    gap: 6px 12px;
    color: var(--cm-color-text);
}
.auth-form.cm-field-contract .auth-field-grid > label > :is(.cm-field-host, .core-relpicker, .errorlist) {
    grid-column: 2;
    min-width: 0;
}
.auth-form.cm-field-contract .auth-field-grid .auth-label-text { display: block; }
body.public-mode.auth-page:is(.color-mode-light, .color-mode-dark) .auth-form.cm-field-contract input[data-relpicker] {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 7px 1px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--cm-color-text);
    box-shadow: none;
    font: inherit;
}
body .auth-form.cm-field-contract [data-relpicker]:focus {
    outline: 0;
    box-shadow: inset 0 -2px 0 var(--cm-field-underline-focus);
}
.auth-form.cm-field-contract .cm-field-display,
.auth-form.cm-field-contract .cm-field-host.is-editing > :is(input, select, textarea) {
    min-height: 44px;
    font-size: 16px;
}
.auth-form.cm-field-contract .signup-bio .cm-field-display {
    white-space: normal;
}
.auth-form.cm-field-contract .signup-bio .cm-field-host.is-editing > textarea {
    height: auto;
    min-height: 130px;
}
.auth-form.cm-field-contract .auth-profile-intent .cm-chip-select {
    border: 0;
    background: transparent;
    padding: 0;
}
.cm-field-contract {
    --cm-field-underline: color-mix(in srgb, var(--cm-color-text, #f2f6fb) 14%, transparent);
    --cm-field-underline-hover: color-mix(in srgb, var(--cm-color-text, #f2f6fb) 34%, transparent);
    --cm-field-underline-focus: var(--accent, #2f82ff);
    --cm-field-label-width: minmax(130px, 32%);
}

.settings-form.cm-field-contract {
    --cm-color-text: var(--ink, #172033);
    --cm-color-muted: var(--muted, #617086);
    --accent: #2f80d8;
    gap: 8px;
    padding: 14px 18px;
}

.settings-form.cm-field-contract .settings-group-fields {
    gap: 2px;
}

.settings-form.cm-field-contract .settings-field:not(.checkbox-row) {
    display: grid;
    grid-template-columns: var(--cm-field-label-width) minmax(0, 1fr);
    align-items: center;
    gap: 0 18px;
    min-height: 38px;
    padding: 2px 0;
}

.settings-form.cm-field-contract .settings-plugin-head,
.settings-form.cm-field-contract .settings-group-head {
    grid-column: 1 / -1;
}

.settings-form.cm-field-contract .settings-field > label {
    grid-column: 1;
    margin: 0;
    padding: 7px 0;
    color: var(--cm-color-text, #172033);
    font-size: 0.9rem;
    font-weight: 700;
}

.settings-form.cm-field-contract .settings-field > .cm-field-host,
.settings-form.cm-field-contract .settings-field > input,
.settings-form.cm-field-contract .settings-field > select,
.settings-form.cm-field-contract .settings-field > textarea {
    grid-column: 2;
    min-width: 0;
    width: 100%;
}

.settings-form.cm-field-contract .settings-field > .settings-help {
    grid-column: 2;
    display: none;
    margin: 0;
    padding: 0 0 5px;
    font-size: 0.78rem;
    line-height: 1.35;
}

.settings-form.cm-field-contract .settings-field:focus-within > .settings-help,
.profile-editor.cm-field-contract .profile-editor-field:focus-within > .profile-editor-help {
    display: block;
}

.settings-form.cm-field-contract .settings-field.checkbox-row {
    min-height: 34px;
    padding: 2px 0;
}

.settings-form.cm-field-contract .settings-field.checkbox-row label {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: var(--cm-color-text, #172033);
}

.settings-form.cm-field-contract .settings-field.checkbox-row input {
    order: 2;
    flex: 0 0 auto;
}

.profile-editor.cm-field-contract .profile-editor-fields,
.profile-editor.cm-field-contract .profile-editor-fields.two,
.profile-editor.cm-field-contract .profile-editor-fields.three {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
}

.profile-editor.cm-field-contract .profile-editor-field {
    display: grid;
    grid-template-columns: var(--cm-field-label-width) minmax(0, 1fr);
    align-items: center;
    gap: 0 18px;
    min-height: 38px;
    padding: 2px 0;
}

.profile-editor.cm-field-contract .profile-editor-field > label {
    grid-column: 1;
    margin: 0;
    padding: 7px 0;
}

.profile-editor.cm-field-contract .profile-editor-field > .cm-field-host,
.profile-editor.cm-field-contract .profile-editor-field > .cm-chip-select,
.profile-editor.cm-field-contract .profile-editor-field > .geo-select-wrap {
    grid-column: 2;
    min-width: 0;
    width: 100%;
}

.profile-editor.cm-field-contract .profile-editor-field > .geo-combobox {
    grid-column: 2;
    min-width: 0;
}
.cm-field-contract .geo-combobox > input {
    min-height: 38px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--cm-color-text, #f2f6fb);
    font: inherit;
    padding: 7px 1px;
    box-shadow: none;
}
.cm-field-contract .geo-combobox > input:focus {
    outline: none;
    box-shadow: inset 0 -2px 0 var(--cm-field-underline-focus);
}

.profile-editor.cm-field-contract .profile-editor-field > .profile-editor-help,
.profile-editor.cm-field-contract .profile-editor-field > .errorlist {
    grid-column: 2;
    margin: 0;
}

.profile-editor.cm-field-contract .profile-editor-field > .profile-editor-help {
    display: none;
}

.cm-field-contract .cm-field-host {
    position: relative;
    min-width: 0;
    width: 100%;
}

.cm-field-contract .cm-field-display {
    display: block;
    box-sizing: border-box;
    width: 100%;
    min-height: 36px;
    padding: 8px 1px 6px;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: inset 0 -1px 0 transparent;
    color: var(--cm-color-text, #f2f6fb);
    font: inherit;
    line-height: 1.35;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: text;
    transition: box-shadow 140ms ease, color 140ms ease;
}

.cm-field-contract .cm-field-display:hover {
    box-shadow: inset 0 -1px 0 var(--cm-field-underline-hover);
}

.cm-field-contract .cm-field-display:focus-visible {
    outline: 0;
    box-shadow: inset 0 -2px 0 var(--cm-field-underline-focus);
}

.cm-field-contract .cm-field-display.is-empty {
    color: var(--cm-color-muted, #8b95a7);
}

.cm-field-contract .cm-field-host > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea) {
    display: none;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 36px;
    margin: 0;
    padding: 7px 1px 5px;
    border: 0;
    border-radius: 0;
    outline: 0;
    background: transparent;
    box-shadow: inset 0 -1px 0 var(--cm-field-underline);
    color: var(--cm-color-text, #f2f6fb);
    font: inherit;
    line-height: 1.35;
    transition: box-shadow 140ms ease;
}

.cm-field-contract .cm-field-host.is-editing > :where(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea) {
    display: block;
}

.cm-field-contract .cm-field-host.is-editing > .cm-field-display {
    display: none;
}

.cm-field-contract .cm-field-host.is-editing > :is(input, select, textarea):focus {
    box-shadow: inset 0 -2px 0 var(--cm-field-underline-focus);
}

.cm-field-contract .cm-field-host > textarea,
.cm-field-contract .cm-field-host.is-editing > textarea {
    min-height: 42px;
    height: 42px;
    resize: vertical;
}

.cm-field-contract .cm-field-host.is-multiline > textarea {
    display: block;
    min-height: 36px;
    height: auto;
    overflow: hidden;
    resize: none;
    box-shadow: none;
    overflow-wrap: anywhere;
}
.cm-field-contract .cm-field-host.is-multiline > textarea:focus {
    box-shadow: inset 0 -2px 0 var(--cm-field-underline-focus);
}

.policy-gate-panel {
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    scrollbar-gutter: stable;
    color: var(--cm-color-text, #f2f6fb);
}
.policy-gate-panel .profile-editor-field { margin-block: 12px; }
.policy-gate-panel > .core-modal-body { min-width: 0; }
.policy-gate-panel .profile-editor { display: block; padding: 0; min-width: 0; }
.policy-gate-panel .profile-editor label { color: inherit; }
.policy-gate-panel .policy-field-error { grid-column: 2; font-size: .85rem; }
.policy-gate-panel [data-policy-error], .policy-field-error { color: #fca5a5; }
.policy-gate-panel input[type="file"] { min-width: 0; width: 100%; }
.policy-gate-panel .core-modal-footer { flex-wrap: wrap; }
html[data-color-mode="light"] .policy-gate-panel { background: #fff; color: #172033; --cm-color-text: #172033; --cm-color-muted: #526175; }
html[data-color-mode="light"] .policy-gate-panel [data-policy-error],
html[data-color-mode="light"] .policy-field-error { color: #b42318; }

.cm-field-contract .cm-field-host :is(input, select, textarea):disabled,
.cm-field-contract .cm-field-host :is(input, select, textarea)[readonly] {
    color: var(--cm-color-muted, #8b95a7);
    cursor: not-allowed;
}

body.public-mode.color-mode-light .cm-field-contract .cm-field-host > :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), select, textarea),
body.public-mode.color-mode-light .cm-field-contract .cm-field-display {
    color: var(--cm-color-text);
    background: transparent;
    border: 0;
}

@media (max-width: 680px) {
    .cm-field-contract {
        --cm-field-label-width: minmax(105px, 38%);
    }

    .settings-form.cm-field-contract {
        padding: 10px 12px;
    }

    .settings-form.cm-field-contract .settings-field:not(.checkbox-row),
    .profile-editor.cm-field-contract .profile-editor-field {
        gap: 0 10px;
    }

    .profile-editor.cm-field-contract .profile-editor-fields {
        padding-inline: 12px;
    }
}

@media (max-width: 390px) {
    .cm-field-contract {
        --cm-field-label-width: minmax(88px, 42%);
    }
}
