/*
 * Product edit screen: the Marketplaces tab, its opener and the Marketplace Information
 * window. Shared components come from ktmp-ui.css; this file holds only what this screen
 * adds, and the window parts whose markup other code reads by class.
 */

/* The tab's icon, drawn like WooCommerce's own tab icons. */
#woocommerce-product-data ul.wc-tabs li.ktmp-pm-data-tab a::before {
    font-family: dashicons;
    content: "\f513";
}

/* Opener: the button with its description. */
#woocommerce-product-data .ktmp-pm-opener,
.ktmp-pm-opener {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ktmp-space-2) var(--ktmp-space-3);
    margin: 9px 0;
    padding: 5px 12px;
}

.ktmp-pm-opener-hint {
    font-size: var(--ktmp-type-body-size);
    color: var(--ktmp-text-muted);
}

/*
 * The opener's icon: named through the product data box, so WooCommerce's panel rules
 * cannot change its size or line; the glyph fills its box, centred on the text line.
 */
#woocommerce-product-data .ktmp-pm-open .ktmp-button__icon.dashicons,
.ktmp-pm-open .ktmp-button__icon.dashicons {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    width: 18px;
    height: 18px;
    margin: 0;
    font-size: 18px;
    line-height: 1;
}

#woocommerce-product-data .ktmp-pm-open .ktmp-button__icon.dashicons::before,
.ktmp-pm-open .ktmp-button__icon.dashicons::before {
    display: block;
    line-height: 18px;
}

/* Variation rows float their fields, so the opener takes a full line of its own. */
.ktmp-pm-opener-row {
    clear: both;
}

.ktmp-pm-opener-row .ktmp-pm-opener,
#woocommerce-product-data .ktmp-pm-opener-row .ktmp-pm-opener {
    margin: 0 0 var(--ktmp-space-2);
    padding: 0;
}

/* Window frame */
.ktmp-pm-subject:empty {
    display: none;
}

.ktmp-pm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.ktmp-pm-loading .ktmp-loading-spinner {
    margin: 0;
}

.ktmp-pm-panel .ktmp-pm-panel {
    margin-top: var(--ktmp-space-4);
}

.ktmp-pm-notice.notice {
    margin: 0 0 var(--ktmp-space-4);
}

.ktmp-pm-empty {
    margin: 0 0 var(--ktmp-space-2);
    font-size: var(--ktmp-type-body-size);
    color: var(--ktmp-text-muted);
}

/* Countries: a plain heading, the hint and the country tabs. */
.ktmp-pm-modal .ktmp-pm-section-title.is-plain {
    margin: var(--ktmp-space-6) 0 var(--ktmp-space-2);
    font-size: var(--ktmp-type-card-title-size);
    font-weight: var(--ktmp-weight-strong);
}

.ktmp-pm-countrylist {
    margin-bottom: var(--ktmp-space-2);
}

/* Sections: a card with a heading button that folds the body. */
.ktmp-pm-box {
    margin: 0 0 var(--ktmp-space-4);
}

.ktmp-pm-box + .ktmp-pm-box {
    margin-top: 0;
}

.ktmp-pm-modal .ktmp-pm-section-title {
    margin: 0;
    padding: 0;
    font-size: inherit;
}

.ktmp-pm-toggle {
    display: flex;
    align-items: center;
    gap: var(--ktmp-space-2);
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 0 var(--ktmp-space-4);
    border: 0;
    border-radius: 7px 7px 0 0;
    background: none;
    text-align: start;
    font-size: var(--ktmp-type-card-title-size);
    line-height: var(--ktmp-type-card-title-line);
    font-weight: var(--ktmp-weight-strong);
    color: var(--ktmp-text);
    cursor: pointer;
    transition: background-color var(--ktmp-motion);
}

.ktmp-pm-toggle[aria-expanded="false"] {
    border-radius: 7px;
}

.ktmp-pm-toggle:hover {
    background: var(--ktmp-surface);
}

.ktmp-pm-toggle:focus-visible {
    outline: var(--ktmp-focus-width) solid var(--ktmp-accent);
    outline-offset: var(--ktmp-focus-offset);
}

.ktmp-pm-toggle > .dashicons {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    font-size: 16px;
    color: var(--ktmp-text-secondary);
    transition: transform var(--ktmp-motion);
}

.ktmp-pm-toggle[aria-expanded="false"] > .dashicons {
    transform: rotate(-90deg);
}

.rtl .ktmp-pm-toggle[aria-expanded="false"] > .dashicons {
    transform: rotate(90deg);
}

/* Shown only on a folded heading whose section has unsaved changes. */
.ktmp-pm-unsaved {
    display: none;
}

.ktmp-pm-toggle.has-unsaved .ktmp-pm-unsaved {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: var(--ktmp-radius-pill);
    background: var(--ktmp-accent-tint);
    color: var(--ktmp-accent);
}

.ktmp-pm-unsaved .dashicons {
    width: 14px;
    height: 14px;
    font-size: 14px;
}

.ktmp-pm-section {
    padding: var(--ktmp-space-4);
    border-top: 1px solid var(--ktmp-border-light);
}

.ktmp-pm-section:has(> .ktmp-pm-table) {
    padding-block: 0;
}

/* Field rows: label column, control with its marks, then the notes under the control. */
.ktmp-pm-table,
.ktmp-pm-table > tbody {
    display: block;
    width: 100%;
}

.ktmp-pm-row {
    display: grid;
    grid-template-columns: var(--ktmp-form-label-width) minmax(0, 1fr);
    gap: var(--ktmp-space-2) var(--ktmp-space-6);
    padding: 14px 0;
}

.ktmp-pm-row + .ktmp-pm-row {
    border-top: 1px solid var(--ktmp-border-light);
}

/* Required fields come first; a stronger line ends them. */
.ktmp-pm-row:has(.ktmp-pm-required) + .ktmp-pm-row:not(:has(.ktmp-pm-required)) {
    border-top-width: 2px;
}

.ktmp-pm-row > th,
.ktmp-pm-row > td {
    display: block;
    width: auto;
    padding: 0;
    text-align: start;
}

.ktmp-pm-row > th {
    padding-top: 7px;
    font-size: var(--ktmp-type-label-size);
    line-height: var(--ktmp-type-label-line);
    font-weight: var(--ktmp-weight-strong);
    color: var(--ktmp-text);
}

.ktmp-pm-required {
    margin-inline-start: 2px;
    color: var(--ktmp-error-text);
}

.ktmp-pm-control {
    display: flex;
    align-items: flex-start;
    gap: var(--ktmp-space-2);
}

.ktmp-pm-modal .ktmp-pm-control > .ktmp-pm-input:not([type="checkbox"]) {
    box-sizing: border-box;
    flex: 1 1 auto;
    width: 100%;
    max-width: 480px;
    min-height: var(--ktmp-control-height);
    margin: 0;
    border-color: var(--ktmp-border);
    border-radius: var(--ktmp-radius-sm);
    font-size: var(--ktmp-type-form-size);
}

/* A category value list with search: the Select2 box takes the select's place and width. */
.ktmp-pm-modal .ktmp-pm-control > .select2-container {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 480px;
}

/* WooCommerce already draws the arrow of a Select2 box on this screen, so the theme's own is left out. */
.ktmp-pm-modal .select2-container--ktmp .select2-selection--single .select2-selection__arrow::before {
    content: none;
}

.ktmp-pm-modal .ktmp-pm-input[aria-invalid="true"] {
    border-color: var(--ktmp-error);
    box-shadow: 0 0 0 1px var(--ktmp-error);
}

.ktmp-pm-control > input[type="checkbox"].ktmp-pm-input {
    margin: 10px 0 0;
}

.ktmp-pm-control > .ktmp-pm-image {
    flex: 0 0 auto;
}

/* The marks column keeps its width when empty, so every control ends on the same line. */
.ktmp-pm-marks {
    display: flex;
    flex: 0 0 60px;
    align-items: center;
    gap: var(--ktmp-space-1);
    min-height: var(--ktmp-control-height);
    margin-inline-start: auto;
}

.ktmp-pm-row .description {
    margin: 6px 0 0;
    font-size: var(--ktmp-type-small-size);
    line-height: var(--ktmp-type-small-line);
    color: var(--ktmp-text-muted);
}

.ktmp-pm-row .ktmp-pm-shared {
    display: flex;
    gap: var(--ktmp-space-1);
    padding: 6px var(--ktmp-space-2);
    border-radius: var(--ktmp-radius-sm);
    background: var(--ktmp-accent-tint);
    color: var(--ktmp-text);
}

.ktmp-pm-row .ktmp-pm-refused {
    display: flex;
    gap: var(--ktmp-space-1);
    color: var(--ktmp-warning-text);
}

.ktmp-pm-row .ktmp-pm-shared::before,
.ktmp-pm-row .ktmp-pm-refused::before {
    flex-shrink: 0;
    font: normal 16px/1.1 dashicons;
}

.ktmp-pm-row .ktmp-pm-shared::before {
    content: "\f348";
    color: var(--ktmp-accent);
}

.ktmp-pm-row .ktmp-pm-refused::before {
    content: "\f534";
    color: var(--ktmp-warning);
}

/* Help mark next to a label and source badge next to a control: the words show on hover and focus. */
.ktmp-pm-hint,
.ktmp-pm-source {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    cursor: help;
}

.ktmp-pm-hint {
    color: var(--ktmp-text-muted);
}

.ktmp-pm-hint .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.ktmp-pm-source {
    flex-shrink: 0;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    border-radius: var(--ktmp-radius-pill);
    background: var(--ktmp-neutral-tint);
    color: var(--ktmp-text-secondary);
}

.ktmp-pm-source .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.ktmp-pm-hint:focus-visible,
.ktmp-pm-source:focus-visible {
    outline: var(--ktmp-focus-width) solid var(--ktmp-accent);
    outline-offset: var(--ktmp-focus-offset);
}

.ktmp-pm-hint-text,
.ktmp-pm-source-text {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 30;
    width: max-content;
    max-width: 240px;
    padding: var(--ktmp-space-1) var(--ktmp-space-2);
    border-radius: var(--ktmp-radius-sm);
    background: var(--ktmp-text);
    font-size: var(--ktmp-type-small-size);
    font-weight: 400;
    line-height: 1.4;
    color: #fff;
    white-space: normal;
    text-align: start;
    pointer-events: none;
    transform: translateX(-50%);
    clip-path: inset(50%);
    opacity: 0;
}

.ktmp-pm-hint:hover .ktmp-pm-hint-text,
.ktmp-pm-hint:focus .ktmp-pm-hint-text,
.ktmp-pm-source:hover .ktmp-pm-source-text,
.ktmp-pm-source:focus .ktmp-pm-source-text {
    clip-path: none;
    opacity: 1;
}

.ktmp-pm-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--ktmp-border-strong);
    border-radius: var(--ktmp-radius-sm);
    background: var(--ktmp-surface-card);
    color: var(--ktmp-error-text);
    cursor: pointer;
}

.ktmp-pm-remove:hover {
    background: var(--ktmp-error-tint);
}

.ktmp-pm-remove:focus-visible {
    outline: var(--ktmp-focus-width) solid var(--ktmp-accent);
    outline-offset: var(--ktmp-focus-offset);
}

.ktmp-pm-remove[disabled] {
    color: var(--ktmp-text-muted);
    cursor: not-allowed;
}

.ktmp-pm-remove .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* Actions line at the end of a form: status on one side, Save on the other. */
.ktmp-pm-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--ktmp-space-2) var(--ktmp-space-4);
    margin: 0 calc(-1 * var(--ktmp-space-4));
    padding: var(--ktmp-space-3) var(--ktmp-space-4);
    border-top: 1px solid var(--ktmp-border-light);
    border-radius: 0 0 7px 7px;
    background: var(--ktmp-surface);
}

.ktmp-pm-actions .ktmp-pm-save {
    margin-inline-start: auto;
}

/* Status lines: neutral while working, green with a tick, red with a warning. */
.ktmp-pm-message,
.ktmp-pm-link-message,
.ktmp-pm-family-message,
.ktmp-pm-family-state,
.ktmp-pm-apply-state {
    display: inline-flex;
    align-items: center;
    gap: var(--ktmp-space-1);
    font-size: var(--ktmp-type-body-size);
    color: var(--ktmp-text-muted);
}

.ktmp-pm-message.is-success,
.ktmp-pm-link-message.is-success,
.ktmp-pm-family-message.is-success,
.ktmp-pm-family-state.is-success,
.ktmp-pm-apply-state.is-success {
    color: var(--ktmp-success-text);
}

.ktmp-pm-message.is-error,
.ktmp-pm-link-message.is-error,
.ktmp-pm-family-message.is-error,
.ktmp-pm-family-state.is-error,
.ktmp-pm-apply-state.is-error {
    color: var(--ktmp-error-text);
}

.ktmp-pm-message.is-success:not(:empty)::before,
.ktmp-pm-link-message.is-success:not(:empty)::before,
.ktmp-pm-family-message.is-success:not(:empty)::before,
.ktmp-pm-family-state.is-success:not(:empty)::before,
.ktmp-pm-apply-state.is-success:not(:empty)::before {
    content: "\f147";
    font: normal 18px/1 dashicons;
    color: var(--ktmp-success);
}

.ktmp-pm-message.is-error:not(:empty)::before,
.ktmp-pm-link-message.is-error:not(:empty)::before,
.ktmp-pm-family-message.is-error:not(:empty)::before,
.ktmp-pm-family-state.is-error:not(:empty)::before,
.ktmp-pm-apply-state.is-error:not(:empty)::before {
    content: "\f534";
    font: normal 16px/1 dashicons;
    color: var(--ktmp-error);
}

.ktmp-pm-family-message.is-success {
    font-weight: var(--ktmp-weight-strong);
}

.ktmp-pm-family-message.is-info {
    display: flex;
    padding: 6px var(--ktmp-space-2);
    border-radius: var(--ktmp-radius-sm);
    background: var(--ktmp-accent-tint);
    font-size: var(--ktmp-type-small-size);
    color: var(--ktmp-text);
}

.ktmp-pm-family-message.is-info::before {
    content: "\f348";
    font: normal 16px/1 dashicons;
    color: var(--ktmp-accent);
}

/* Catalog: the linked record, the search line, hints and results. */
.ktmp-pm-link-current {
    margin-bottom: var(--ktmp-space-3);
}

.ktmp-pm-link-has {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px var(--ktmp-space-3);
    margin: 0;
    padding: var(--ktmp-space-3) var(--ktmp-space-4);
    border: 1px solid var(--ktmp-border-light);
    border-radius: var(--ktmp-radius-lg);
    background: var(--ktmp-surface);
}

.ktmp-pm-link-title {
    font-weight: var(--ktmp-weight-strong);
}

.ktmp-pm-link-has .ktmp-pm-link-id {
    padding: 1px 6px;
    border: 1px solid var(--ktmp-border-light);
    border-radius: var(--ktmp-radius-sm);
    background: var(--ktmp-surface-card);
    font-family: var(--ktmp-font-mono);
    font-size: var(--ktmp-type-code-size);
    color: var(--ktmp-text);
    overflow-wrap: anywhere;
}

.ktmp-pm-link .ktmp-pm-link-current .ktmp-pm-link-unlink {
    text-decoration: underline;
}

/* Where the record stands for a sent product, the button deletes it. */
.ktmp-pm-link[data-pick] .ktmp-pm-link-current .ktmp-pm-link-unlink {
    color: var(--ktmp-error-text);
}

.ktmp-pm-link-current .ktmp-pm-link-unlink-note {
    margin: 6px 0 0;
    font-size: var(--ktmp-type-small-size);
    color: var(--ktmp-text-muted);
}

.ktmp-pm-linkform {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ktmp-space-2);
}

.ktmp-pm-modal .ktmp-pm-link-mode {
    flex: 0 0 170px;
    min-height: var(--ktmp-control-height);
}

.ktmp-pm-modal .ktmp-pm-link-query {
    flex: 1 1 200px;
    width: auto;
    min-height: var(--ktmp-control-height);
}

.ktmp-pm-modal .ktmp-pm-link-hint {
    margin: 6px 0 0;
    font-size: var(--ktmp-type-small-size);
    color: var(--ktmp-text-muted);
}

.ktmp-pm-link-message {
    display: flex;
    margin: var(--ktmp-space-3) 0 0;
}

.ktmp-pm-link-message:empty,
.ktmp-pm-family-message:empty {
    display: none;
}

.ktmp-pm-link-results:not(:empty) {
    margin-top: var(--ktmp-space-3);
}

.ktmp-pm-link-results[role="list"] {
    overflow: hidden;
    border: 1px solid var(--ktmp-border-strong);
    border-radius: var(--ktmp-radius-lg);
}

.ktmp-pm-link-card {
    display: flex;
    align-items: center;
    gap: var(--ktmp-space-3);
    padding: var(--ktmp-space-3);
}

.ktmp-pm-link-card + .ktmp-pm-link-card {
    border-top: 1px solid var(--ktmp-border-light);
}

.ktmp-pm-link-thumb {
    flex-shrink: 0;
}

.ktmp-pm-link-cardbody {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ktmp-pm-link-cardtitle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.ktmp-pm-link-cardname {
    font-size: var(--ktmp-type-card-title-size);
    font-weight: var(--ktmp-weight-strong);
    color: var(--ktmp-text);
}

.ktmp-pm-link-cardmeta {
    font-size: var(--ktmp-type-small-size);
    color: var(--ktmp-text-muted);
}

.ktmp-pm-link-out {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: var(--ktmp-type-small-size);
}

.ktmp-pm-link-out .dashicons {
    width: 14px;
    height: 14px;
    font-size: 14px;
}

.ktmp-pm-link-card > .button {
    flex-shrink: 0;
}

.ktmp-pm-link-more:not(:empty) {
    margin-top: var(--ktmp-space-3);
}

/* Family part: the other variations against the linked record's family. */
.ktmp-pm-family {
    margin: 0 0 var(--ktmp-space-4);
}

.ktmp-pm-family > p {
    margin: 0 0 var(--ktmp-space-2);
}

.ktmp-pm-family-rows:not(:empty) {
    margin-top: var(--ktmp-space-3);
}

.ktmp-pm-family-table {
    min-width: 560px;
}

.ktmp-pm-family-unit {
    font-weight: var(--ktmp-weight-strong);
}

.ktmp-pm-modal .ktmp-pm-family-choice {
    width: 100%;
    max-width: none;
}

.ktmp-pm-family-linked {
    font-size: var(--ktmp-type-small-size);
    color: var(--ktmp-text-muted);
}

.ktmp-pm-family-actions:not(:empty) {
    margin-top: var(--ktmp-space-3);
}

/* A personalization part: a tag under its name and the character limit box under its value. */
.ktmp-pm-tag {
    display: table;
    margin-top: 4px;
    padding: 2px var(--ktmp-space-2);
    border-radius: var(--ktmp-radius-pill);
    background: var(--ktmp-neutral-tint);
    font-size: var(--ktmp-type-small-size);
    font-weight: var(--ktmp-weight-strong);
    color: var(--ktmp-text-secondary);
}

.ktmp-pm-row .ktmp-pm-length {
    display: flex;
    align-items: center;
    gap: var(--ktmp-space-2);
    margin: 6px 0 0;
}

.ktmp-pm-row .ktmp-pm-length[hidden] {
    display: none;
}

/* Applying a category field's value to other variations: the row's link, then the second window. */
.ktmp-pm-row .ktmp-pm-apply-line {
    margin: 6px 0 0;
}

.ktmp-pm-apply-hint {
    margin: 0 0 var(--ktmp-space-3);
    color: var(--ktmp-text-secondary);
}

.ktmp-pm-apply-to-write {
    margin: 0 0 var(--ktmp-space-3);
}

.ktmp-pm-apply-to-write .ktmp-pm-apply-value {
    font-weight: 600;
}

.ktmp-pm-apply-all-line {
    margin: 0 0 var(--ktmp-space-2);
}

.ktmp-pm-apply-check {
    width: 2em;
}

.ktmp-pm-apply-value.is-empty {
    font-style: italic;
    color: var(--ktmp-text-muted);
}

.ktmp-pm-apply-state {
    display: flex;
    margin-top: 4px;
}

.ktmp-pm-apply .ktmp-pm-apply-message {
    margin-inline-end: auto;
}

/* Category fields: one selectable card per category, then that category's form. */
.ktmp-pm-catlist {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ktmp-space-2);
    margin: 0 0 var(--ktmp-space-3);
}

.ktmp-pm-cat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    box-sizing: border-box;
    min-height: 48px;
    margin: 0;
    padding: 6px 14px;
    border: 1px solid var(--ktmp-border-strong);
    border-radius: var(--ktmp-radius-lg);
    background: var(--ktmp-surface-card);
    text-align: start;
    color: var(--ktmp-text);
    cursor: pointer;
    transition: border-color var(--ktmp-motion), background-color var(--ktmp-motion), box-shadow var(--ktmp-motion);
}

.ktmp-pm-cat:hover {
    border-color: var(--ktmp-text-secondary);
}

.ktmp-pm-cat[aria-selected="true"] {
    border-color: var(--ktmp-accent);
    background: var(--ktmp-accent-tint);
    box-shadow: inset 0 0 0 1px var(--ktmp-accent);
}

.ktmp-pm-cat:focus-visible {
    outline: var(--ktmp-focus-width) solid var(--ktmp-accent);
    outline-offset: var(--ktmp-focus-offset);
}

.ktmp-pm-cat-name {
    font-size: var(--ktmp-type-body-size);
    font-weight: var(--ktmp-weight-strong);
}

.ktmp-pm-cat-match {
    font-size: var(--ktmp-type-small-size);
    color: var(--ktmp-text-muted);
}

.ktmp-pm-cat-panels > .ktmp-pm-panel[aria-busy="true"] {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    border: 1px solid var(--ktmp-border-light);
    border-radius: var(--ktmp-radius-lg);
}

.ktmp-pm-cat-panels > .ktmp-pm-panel[aria-busy="true"] .ktmp-pm-loading {
    min-height: 0;
}

.ktmp-pm-catform {
    padding: 0 var(--ktmp-space-4);
    border: 1px solid var(--ktmp-border-light);
    border-radius: var(--ktmp-radius-lg);
}

.ktmp-pm-catempty .ktmp-pm-empty {
    margin: 0;
    color: var(--ktmp-text);
}

.ktmp-pm-catempty .dashicons-warning {
    color: var(--ktmp-warning);
}

/* "Add a field": the last row before the actions, read as a tool rather than a field. */
.ktmp-pm-add {
    display: grid;
    grid-template-columns: var(--ktmp-form-label-width) minmax(0, 1fr);
    align-items: center;
    gap: var(--ktmp-space-2) var(--ktmp-space-6);
    margin: 0 calc(-1 * var(--ktmp-space-4));
    padding: var(--ktmp-space-3) var(--ktmp-space-4);
    border-top: 1px solid var(--ktmp-border-light);
    background: var(--ktmp-surface);
}

.ktmp-pm-add-label {
    font-size: var(--ktmp-type-label-size);
    font-weight: 400;
}

.ktmp-pm-combo {
    position: relative;
    display: block;
    max-width: 480px;
}

.ktmp-pm-combo > .dashicons {
    position: absolute;
    top: 50%;
    inset-inline-start: 10px;
    width: 16px;
    height: 16px;
    font-size: 16px;
    color: var(--ktmp-text-muted);
    pointer-events: none;
    transform: translateY(-50%);
}

.ktmp-pm-modal .ktmp-pm-combo-input {
    box-sizing: border-box;
    width: 100%;
    min-height: var(--ktmp-control-height);
    margin: 0;
    padding-inline: 34px 64px;
    border-color: var(--ktmp-border);
    border-radius: var(--ktmp-radius-sm);
    font-size: var(--ktmp-type-form-size);
}

.ktmp-pm-combo-count {
    position: absolute;
    top: 50%;
    inset-inline-end: 10px;
    font-size: var(--ktmp-type-small-size);
    color: var(--ktmp-text-muted);
    pointer-events: none;
    transform: translateY(-50%);
}

.ktmp-pm-combo-list {
    position: absolute;
    top: calc(100% + var(--ktmp-space-1));
    inset-inline: 0;
    z-index: 20;
    max-height: 240px;
    margin: 0;
    padding: var(--ktmp-space-1) 0;
    overflow-y: auto;
    border: 1px solid var(--ktmp-border-strong);
    border-radius: var(--ktmp-radius-lg);
    background: var(--ktmp-surface-card);
    box-shadow: var(--ktmp-shadow-overlay);
    list-style: none;
}

.ktmp-pm-combo-option {
    margin: 0;
    padding: 6px var(--ktmp-space-3);
    font-size: var(--ktmp-type-body-size);
    color: var(--ktmp-text);
    cursor: pointer;
}

.ktmp-pm-combo-option.is-active {
    background: var(--ktmp-accent);
    color: #fff;
}

/* Narrow screens: the core admin breakpoint. */
@media screen and (max-width: 782px) {
    #woocommerce-product-data .ktmp-pm-opener,
    .ktmp-pm-opener {
        flex-direction: column;
        align-items: stretch;
    }

    .ktmp-pm-opener .ktmp-pm-open {
        justify-content: center;
        min-height: var(--ktmp-control-height-touch);
        font-size: var(--ktmp-type-form-size);
    }

    .ktmp-pm-row,
    .ktmp-pm-add {
        grid-template-columns: minmax(0, 1fr);
    }

    .ktmp-pm-row > th {
        padding-top: 0;
    }

    .ktmp-pm-modal .ktmp-pm-control > .ktmp-pm-input:not([type="checkbox"]),
    .ktmp-pm-modal .ktmp-pm-combo-input,
    .ktmp-pm-modal .ktmp-pm-link-mode,
    .ktmp-pm-modal .ktmp-pm-link-query {
        min-height: var(--ktmp-control-height-touch);
        font-size: 16px;
    }

    .ktmp-pm-source {
        width: 28px;
        height: 28px;
    }

    .ktmp-pm-modal .ktmp-pm-link-mode,
    .ktmp-pm-modal .ktmp-pm-link-query {
        flex-basis: 100%;
    }

    .ktmp-pm-link-card {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ktmp-pm-toggle,
    .ktmp-pm-toggle > .dashicons,
    .ktmp-pm-cat {
        transition: none;
    }
}
