/* =============================================================================
 * AI eShop Optimizer — Discount & Marketplace Management (DMM)
 * Sits on top of aieo-admin-panel.css so the whole page inherits the Oxford
 * Metadata look. Only DMM-specific additions live here.
 * ========================================================================== */

/* --------------------------------------------------------------------------
 *  Subtab bar — pill buttons, matches the top-bar nav style.
 *  Accent color is variable-driven so the same DOM/CSS can render in the
 *  three brand colors used across the AIEO admin:
 *    • DMM (Storefront Manager) → pink/magenta (default, `#f11569`)
 *    • Analytics (Optimizer)    → brand blue (variant `--analytics`)
 *    • AI Chat                  → violet      (variant `--chat`)
 *  Pages that use the anchor-based in-page TOC variant add the
 *  `.aieo-dmm-subtab-bar--analytics` or `--chat` modifier on the wrapper.
 * -------------------------------------------------------------------------- */
.aieo-dmm-subtab-bar {
    /* Pink/magenta — matches the brand DMM accent that's been live since
       2026-02. Overridden by the per-page modifiers below. */
    --aieo-subtab-accent: #f11569;
    --aieo-subtab-accent-shadow: rgba(241, 21, 105, 0.3);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    background: #fff;
    padding: 14px 20px;
    margin: 0 0 20px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    /* Stick directly beneath the sticky AIEO top bar while scrolling:
       32px WP admin bar + ~76px top bar = 108px. z-index below the top bar
       (1001) but above page content + high enough for the drop-down menus. */
    position: -webkit-sticky;
    position: sticky;
    top: 108px;
    z-index: 1000;
}
@media screen and (max-width: 782px) {
    /* WP admin bar 46px + ~76px top bar = 122px. */
    .aieo-dmm-subtab-bar { top: 122px; }
}
.aieo-dmm-subtab-bar--analytics {
    --aieo-subtab-accent: #3858e9;   /* brand blue (matches the logo arrow) */
    --aieo-subtab-accent-shadow: rgba(56, 88, 233, 0.3);
}
.aieo-dmm-subtab-bar--chat {
    --aieo-subtab-accent: #7c3aed;   /* violet — distinct from pink + blue */
    --aieo-subtab-accent-shadow: rgba(124, 58, 237, 0.3);
}
.aieo-dmm-subtab {
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    color: #6b7280 !important;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1;
}
.aieo-dmm-subtab:hover {
    color: #667eea !important;
    background: rgba(102, 126, 234, 0.10);
}
.aieo-dmm-subtab.is-active,
.aieo-dmm-subtab.is-active:hover {
    color: #fff !important;
    background: var(--aieo-subtab-accent);
    box-shadow: 0 2px 6px var(--aieo-subtab-accent-shadow);
}

/* --------------------------------------------------------------------------
 *  Grouped subtab — top-level pill that reveals a dropdown of child subtabs
 *  on hover or focus. Uses the same pill aesthetic as a regular subtab so
 *  the bar reads consistently. The caret on the right hints at the group.
 * -------------------------------------------------------------------------- */
.aieo-dmm-subtab-group {
    position: relative;
}
.aieo-dmm-subtab--group {
    /* button-reset so it matches the <a> pills in the bar */
    border: 0;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
}
.aieo-dmm-subtab--group .aieo-dmm-caret {
    transition: transform 0.2s ease;
    opacity: 0.7;
}
.aieo-dmm-subtab-group:hover .aieo-dmm-subtab--group .aieo-dmm-caret,
.aieo-dmm-subtab-group:focus-within .aieo-dmm-subtab--group .aieo-dmm-caret {
    transform: rotate(180deg);
}
/* When a child subtab is the active page, color the parent group pill so
   the user knows where they are. Inherits the variable-driven accent. */
.aieo-dmm-subtab--group.is-active,
.aieo-dmm-subtab--group.is-active:hover {
    color: #fff !important;
    background: var(--aieo-subtab-accent);
    box-shadow: 0 2px 6px var(--aieo-subtab-accent-shadow);
}

.aieo-dmm-subtab-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    /* Above page content incl. the wpDataTables sticky filter box, which sets
       z-index:99999999 !important via a high-specificity ID rule we can't
       cleanly out-specify (its id is dynamic) — so the panel sits above it. */
    z-index: 2147483647;
}
.aieo-dmm-subtab-group:hover .aieo-dmm-subtab-menu,
.aieo-dmm-subtab-group:focus-within .aieo-dmm-subtab-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}
.aieo-dmm-subtab-menu-item {
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    color: #6b7280 !important;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.15s ease;
    line-height: 1.2;
    white-space: nowrap;
}
.aieo-dmm-subtab-menu-item:hover {
    color: #667eea !important;
    background: rgba(102, 126, 234, 0.10);
}
.aieo-dmm-subtab-menu-item.is-active,
.aieo-dmm-subtab-menu-item.is-active:hover {
    color: #fff !important;
    background: var(--aieo-subtab-accent);
    box-shadow: 0 2px 6px var(--aieo-subtab-accent-shadow);
}

/* --------------------------------------------------------------------------
 *  Module panel gap
 * -------------------------------------------------------------------------- */
.aieo-dmm-modules-panel { gap: 20px; }

/* --------------------------------------------------------------------------
 *  Section cards (reuse aieo-modules-box look)
 * -------------------------------------------------------------------------- */
.aieo-dmm-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    border-radius: 12px;
}
.aieo-dmm-section > h2 {
    font-size: 20px;
    font-weight: 500;
    line-height: 28px;
    margin: 0 0 2px;
    color: #101517;
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.aieo-dmm-section > h2 .count {
    color: #6b7280;
    font-weight: 400;
    font-size: 14px;
}
.aieo-dmm-section > h3 {
    font-size: 15px;
    margin: 6px 0 0;
    color: #101517;
    font-weight: 600;
}
.aieo-dmm-section > p.description,
.aieo-dmm-section > .description {
    color: #676f78;
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
}

/* Inner sub-cards inside a box. */
.aieo-dmm-card {
    padding: 18px;
    border: 1px solid #e4e4e7;
    background: #fafbfc;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* Stack-spacing between sibling cards. Adjacent-sibling combinator
 * keeps single-card layouts unaffected — the first card sits flush
 * against whatever's above it (h2 / description), only the 2nd+
 * cards in a stack get top margin. */
.aieo-dmm-card + .aieo-dmm-card { margin-top: 16px; }
.aieo-dmm-card h3 { margin: 0; font-size: 15px; font-weight: 600; color: #1f2937; }

/* --------------------------------------------------------------------------
 *  Form layout
 * -------------------------------------------------------------------------- */
.aieo-dmm-form > p { margin: 0 0 14px; }
.aieo-dmm-form label {
    display: block;
    font-weight: 500;
    color: #2c3338;
    margin-bottom: 4px;
    font-size: 13px;
}
/* Labels that wrap a radio or checkbox (the "option" labels) should stay
 * inline — otherwise every option stacks on its own line and breaks radio
 * groups. Uses :has() which is supported in every evergreen browser. */
.aieo-dmm-form label:has(> input[type="radio"]),
.aieo-dmm-form label:has(> input[type="checkbox"]) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 16px 0 0;
    font-weight: 400;
    cursor: pointer;
}
/* Fallback for browsers without :has — attach the aieo-dmm-choice class
 * on option labels inside templates to force inline display. */
.aieo-dmm-form label.aieo-dmm-choice {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 16px 0 0;
    font-weight: 400;
    cursor: pointer;
}
/* Small label that's the "heading" of a radio group. */
.aieo-dmm-form .aieo-dmm-field-label {
    display: block;
    font-weight: 500;
    color: #2c3338;
    margin: 0 0 6px;
    font-size: 13px;
}
.aieo-dmm-form input[type="text"],
.aieo-dmm-form input[type="number"],
.aieo-dmm-form input[type="date"],
.aieo-dmm-form input[type="email"],
.aieo-dmm-form input[type="url"],
.aieo-dmm-form select:not([multiple]),
.aieo-dmm-form textarea {
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5d9;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: none;
    transition: border-color .15s, box-shadow .15s;
}

/* All AIEO-DMM Select2-backed selects — remove the native element from the
 * layout entirely. Select2 v4 only needs the <select> in the DOM for value
 * syncing, not rendered, so display:none is safe and leaves no ghost box. */
select.aieo-dmm-brand-select,
select.aieo-dmm-product-select,
select.aieo-dmm-user-select,
select.aieo-dmm-category-select,
select.aieo-dmm-product-search,
.aieo-dmm-form select[multiple],
.aieo-dmm-form select.select2-hidden-accessible,
select.select2-hidden-accessible {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
}

/* (earlier no-gap rule replaced by the .aieo-dmm-grid rules below) */
.aieo-dmm-form input:focus,
.aieo-dmm-form select:focus,
.aieo-dmm-form textarea:focus {
    border-color: #f11569;
    box-shadow: 0 0 0 2px rgba(241, 21, 105, 0.15);
    outline: none;
}
.aieo-dmm-form .small-text { max-width: 120px; }
.aieo-dmm-form input[type="checkbox"],
.aieo-dmm-form input[type="radio"] {
    margin-right: 6px;
    vertical-align: middle;
}

.aieo-dmm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px 20px;        /* 20px row gap between grid items */
    align-items: start;
    margin-bottom: 16px;   /* breathing room between the grid and the next section (e.g. the "Where will this feed be saved?" card) */
}
/* Every grid cell becomes a vertical stack: label → control → description.
 * Give each element its own gap so a Select2 widget, a date picker and a
 * textarea all line up with the same rhythm no matter what control they use. */
.aieo-dmm-grid p,
.aieo-dmm-form > p {
    margin: 0 0 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.aieo-dmm-grid p > label,
.aieo-dmm-form > p > label { margin-bottom: 0; }

/* Descriptions sit on their own line below the control with a small gap. */
.aieo-dmm-form .description,
.aieo-dmm-grid p .description,
.aieo-dmm-grid p span.description {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.45;
}

.aieo-dmm-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px 16px;
}
.aieo-dmm-checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 400;
}
.aieo-dmm-checkbox-grid code {
    background: #f4f4f4;
    padding: 1px 5px;
    font-size: 11px;
    color: #1f4620;
    border-radius: 3px;
}

.aieo-dmm-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0 0;
    padding-top: 14px;
    border-top: 1px solid #eef0f3;
}

/* Form submit rows (p.submit) — proper vertical breathing room. */
.aieo-dmm-form p.submit,
.aieo-dmm-section p.submit {
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid #eef0f3;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Upload row: file input + primary action side by side. */
.aieo-dmm-upload-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.aieo-dmm-upload-row input[type="file"] {
    flex: 1 1 300px;
    padding: 8px;
    border: 1px dashed #cbd5d9;
    border-radius: 6px;
    background: #fafbfc;
}
.aieo-dmm-upload-row input[type="file"]:hover {
    border-color: #f11569;
    background: #fff7fa;
}

/* Equal-sized buttons in action rows — every .aieo-dmm-btn-fixed button gets
 * the same min-width, height, and visual weight so groups of buttons line
 * up regardless of label length. */
.aieo-dmm-btn-fixed {
    min-width: 200px !important;
    height: 40px !important;
    line-height: 24px !important;
    padding: 7px 18px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    text-align: center !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}
.aieo-dmm-actions .aieo-dmm-btn-fixed,
.aieo-dmm-upload-row .aieo-dmm-btn-fixed {
    flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
 *  Buttons — consistent base + pink "setup" primary
 *
 *  RULE: Every non-small button inside .aieo-dmm-form, .aieo-dmm-section, or
 *  inside .aieo-dmm-actions / p.submit / .aieo-dmm-upload-row gets the same
 *  size and shape. The .button-primary variant tints pink. Row-level
 *  `.button-small` buttons keep the compact WP-default dimensions.
 * -------------------------------------------------------------------------- */
.aieo-dmm-form .button,
.aieo-dmm-section p.submit .button,
.aieo-dmm-actions .button,
.aieo-dmm-upload-row .button {
    min-width: 200px;
    height: 40px;
    box-sizing: border-box;
    padding: 7px 18px !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    line-height: 24px !important;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin: 4px 4px 4px 0;
}
.aieo-dmm-form .button.button-primary,
.aieo-dmm-section p.submit .button.button-primary,
.aieo-dmm-actions .button.button-primary,
.aieo-dmm-upload-row .button.button-primary,
button.aieo-dmm-primary {
    background-color: #f11569 !important;
    border-color: #d40f5a !important;
    color: #fff !important;
    font-weight: 600 !important;
    text-shadow: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}
.aieo-dmm-form .button.button-primary:hover,
.aieo-dmm-section p.submit .button.button-primary:hover,
.aieo-dmm-actions .button.button-primary:hover,
.aieo-dmm-upload-row .button.button-primary:hover,
button.aieo-dmm-primary:hover {
    background-color: #d40f5a !important;
    border-color: #a00c47 !important;
}

/* Row-action buttons (.button-small) stay compact — override the rule above. */
.aieo-dmm-form .button.button-small,
.aieo-dmm-section .button.button-small,
.aieo-dmm-actions .button.button-small {
    min-width: 0 !important;
    height: auto !important;
    padding: 4px 10px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    margin: 0 4px 0 0;
}

/* Tiny inline utility buttons (e.g. field-map "+" add-row) — compact square. */
.aieo-dmm-form .aieo-dmm-feed-add-row,
.aieo-dmm-form button.aieo-dmm-feed-add-row {
    min-width: 36px !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
}

/* Legacy explicit "fixed" class — now identical to the default. Kept so
 * templates that still set it keep working, no size jump. */
.aieo-dmm-btn-fixed {
    min-width: 200px !important;
    height: 40px !important;
    line-height: 24px !important;
    padding: 7px 18px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}
.aieo-dmm-actions .aieo-dmm-btn-fixed,
.aieo-dmm-upload-row .aieo-dmm-btn-fixed {
    flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
 *  Tables (CRUD lists)
 * -------------------------------------------------------------------------- */
.aieo-dmm-section table.widefat,
.aieo-dmm-section table.aieo-table {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}
.aieo-dmm-section table.widefat thead th,
.aieo-dmm-section table.aieo-table thead th {
    background: #f6f7f7;
    font-weight: 600;
    color: #1f2937;
    border-bottom: 1px solid #e4e4e7;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.aieo-dmm-section table.widefat tbody td {
    vertical-align: middle;
}

/* Dedicated AJAX DataTable. */
.aieo-dmm-datatable {
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    overflow: hidden;
}
.aieo-dmm-datatable-toolbar {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #e4e4e7;
    background: #fafbfc;
    align-items: center;
    flex-wrap: wrap;
}
.aieo-dmm-datatable-toolbar input[type="search"],
.aieo-dmm-datatable-toolbar input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #cbd5d9;
    border-radius: 6px;
    min-width: 220px;
}
.aieo-dmm-datatable-toolbar label {
    font-size: 12px;
    color: #555;
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}
.aieo-dmm-datatable-toolbar .spacer { flex: 1; }
.aieo-dmm-datatable table {
    width: 100%;
    border-collapse: collapse;
}
.aieo-dmm-datatable thead th {
    background: #f6f7f7;
    padding: 10px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #4b5563;
    text-align: left;
    border-bottom: 1px solid #e4e4e7;
    user-select: none;
}
.aieo-dmm-datatable thead th.sortable { cursor: pointer; }
.aieo-dmm-datatable thead th.sortable:hover { color: #f11569; }
.aieo-dmm-datatable thead th .sort-indicator { color: #aaa; margin-left: 4px; font-size: 10px; }
.aieo-dmm-datatable thead th.sorted-asc .sort-indicator,
.aieo-dmm-datatable thead th.sorted-desc .sort-indicator { color: #f11569; }
.aieo-dmm-datatable tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f1f2;
    font-size: 13px;
}
.aieo-dmm-datatable tbody tr:hover { background: #fafbfc; }
.aieo-dmm-datatable td.editable {
    cursor: text;
    background: #fffbf2;
    font-variant-numeric: tabular-nums;
}
.aieo-dmm-datatable td.editable:hover { background: #fff3cd; }
.aieo-dmm-datatable td.editable input {
    width: 100%;
    padding: 4px 6px;
    font-size: 13px;
    border: 1px solid #f11569;
    border-radius: 4px;
}
.aieo-dmm-datatable-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-top: 1px solid #e4e4e7;
    background: #fafbfc;
    font-size: 12px;
    color: #555;
    flex-wrap: wrap;
    gap: 10px;
}
.aieo-dmm-datatable-pager {
    display: flex;
    gap: 4px;
}
.aieo-dmm-datatable-pager button {
    padding: 4px 10px;
    border: 1px solid #cbd5d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.aieo-dmm-datatable-pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.aieo-dmm-datatable-pager button.is-current {
    background: #f11569;
    color: #fff;
    border-color: #f11569;
}
.aieo-dmm-datatable-empty {
    padding: 32px;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

.aieo-dmm-pagination { margin: 14px 0; }
.aieo-dmm-pagination .page-numbers {
    padding: 4px 9px;
    border: 1px solid #dcdcde;
    margin: 0 2px;
    text-decoration: none;
    border-radius: 4px;
    color: #333;
}
.aieo-dmm-pagination .page-numbers.current {
    background: #f11569;
    color: #fff;
    border-color: #f11569;
}

/* --------------------------------------------------------------------------
 *  Progress (batches)
 * -------------------------------------------------------------------------- */
.aieo-dmm-progress { margin-top: 12px; }
.aieo-dmm-progress-bar {
    background: #eef0f3;
    height: 14px;
    border-radius: 7px;
    overflow: hidden;
}
.aieo-dmm-progress-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #f11569, #667eea);
    transition: width 0.25s;
    width: 0;
}
.aieo-dmm-progress-text { margin: 6px 0 0; font-size: 12px; color: #555; }
.aieo-dmm-progress-log {
    background: #1e1e1e;
    color: #b8e6b8;
    padding: 10px;
    border-radius: 6px;
    font-size: 11px;
    max-height: 200px;
    overflow: auto;
    font-family: Consolas, "SF Mono", Menlo, monospace;
    margin-top: 8px;
}

/* --------------------------------------------------------------------------
 *  Flash messages
 * -------------------------------------------------------------------------- */
.aieo-dmm-flash {
    position: fixed;
    top: 50px;
    right: 20px;
    z-index: 100000;
    min-width: 260px;
    pointer-events: none;
}
.aieo-dmm-flash-item {
    background: #fff;
    border-left: 4px solid #667eea;
    padding: 12px 16px;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    pointer-events: auto;
    font-size: 13px;
}
.aieo-dmm-flash-item.error { border-left-color: #dc3232; }
.aieo-dmm-flash-item.success { border-left-color: #46b450; }

/* --------------------------------------------------------------------------
 *  Recipe panel (Loyalty Classes tab has a table of radios)
 * -------------------------------------------------------------------------- */
.aieo-dmm-section .form-table th {
    width: 220px;
    font-weight: 600;
    color: #1f2937;
}
.aieo-dmm-section .form-table td select { min-width: 260px; }

/* --------------------------------------------------------------------------
 *  Product Needs editor
 * -------------------------------------------------------------------------- */
.aieo-dmm-needs-zone {
    border: 1px solid #e4e4e7;
    padding: 14px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: #fafbfc;
}
.aieo-dmm-needs-zone h4 {
    margin: 0 0 10px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
}
.aieo-dmm-chips {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
}
.aieo-dmm-chips li {
    background: #f11569;
    color: #fff;
    padding: 6px 14px;
    border-radius: 16px;
    cursor: move;
    font-size: 12px;
    font-weight: 500;
    user-select: none;
    transition: box-shadow 0.15s;
    list-style: none;
}
.aieo-dmm-chips li:hover { box-shadow: 0 2px 6px rgba(241, 21, 105, 0.35); }
/* Internal/hidden needs render grey when chipped so the operator can
   tell at a glance which selections are NOT user-facing. The pink
   default is reserved for needs that actually appear on the storefront. */
.aieo-dmm-chips li.is-hidden {
    background: #6b7280;
    color: #fff;
    box-shadow: none;
}
.aieo-dmm-chips li.is-hidden:hover {
    box-shadow: 0 2px 6px rgba(107, 114, 128, 0.35);
}
.aieo-dmm-chip-placeholder {
    display: inline-block;
    background: rgba(241, 21, 105, 0.15);
    border: 2px dashed rgba(241, 21, 105, 0.5);
    border-radius: 16px;
    min-width: 100px;
    min-height: 26px;
    margin: 0 4px;
    list-style: none;
}
.aieo-dmm-checkboxes {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 1080px;
    overflow: auto;
    /* 6-column balanced grid (slug column removed → labels are short
       enough to fit). Falls back to fewer columns on narrow viewports
       via auto-fit, which keeps each cell at least ~150px wide. */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 4px 12px;
}
@media (min-width: 1100px) {
    .aieo-dmm-checkboxes {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}
.aieo-dmm-checkboxes li {
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12.5px;
    line-height: 1.4;
    transition: background 0.12s;
}
.aieo-dmm-checkboxes li:hover { background: #f3f4f6; }
.aieo-dmm-checkboxes li > label {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    column-gap: 6px;
    cursor: pointer;
    overflow-wrap: anywhere;
}
.aieo-dmm-checkboxes li > label > input[type="checkbox"] {
    margin-top: 2px;
}
.aieo-dmm-checkboxes li.is-hidden-need {
    background: repeating-linear-gradient(
        45deg,
        #f3f4f6,
        #f3f4f6 4px,
        #d1d5db 4px,
        #d1d5db 8px
    );
    border: 1px dashed #6b7280;
}
.aieo-dmm-checkboxes li.is-hidden-need code { background: #d1d5db; }

/* Search input above the available-needs grid. */
.aieo-dmm-needs-search-wrap {
    margin: 0 0 10px;
    position: relative;
}
.aieo-dmm-needs-search {
    width: 100%;
    padding: 7px 10px 7px 30px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}
.aieo-dmm-needs-search:focus { outline: 2px solid #c084fc; outline-offset: 1px; }
.aieo-dmm-needs-search-wrap::before {
    content: "🔍";
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.6;
    pointer-events: none;
}
.aieo-dmm-needs-search-meta {
    font-size: 11px;
    color: #6b7280;
    margin: 4px 2px 0;
    min-height: 14px;
}

/* --------------------------------------------------------------------------
 *  ERP bridge hook cards
 * -------------------------------------------------------------------------- */
.aieo-dmm-hook-card {
    background: #fafbfc;
    padding: 16px 18px;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    margin-bottom: 14px;
}
.aieo-dmm-hook-card h3 { margin-top: 0; font-size: 14px; }
.aieo-dmm-hook-type {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    border-radius: 3px;
    background: #667eea;
    color: #fff;
    margin-right: 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.aieo-dmm-hook-type.aieo-dmm-hook-action { background: #f59e0b; }
.aieo-dmm-code {
    background: #1e1e1e;
    color: #e8e8e8;
    padding: 12px;
    border-radius: 6px;
    white-space: pre-wrap;
    overflow-x: auto;
    font-size: 12px;
    font-family: Consolas, "SF Mono", Menlo, monospace;
}

/* --------------------------------------------------------------------------
 *  Gift badge, field-map, scanner shortcodes
 * -------------------------------------------------------------------------- */
.aieo-dmm-gift-badge {
    display: inline-block;
    background: #46b450;
    color: #fff;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 3px;
    margin-right: 6px;
}
.aieo-dmm-field-map .drag-handle {
    cursor: move;
    color: #999;
    width: 24px;
    text-align: center;
}
.aieo-dmm-staff-scanner,
.aieo-dmm-customer-scanner {
    max-width: 480px;
    margin: 14px 0;
    padding: 18px;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    background: #fff;
}
.aieo-dmm-scanner-result,
.aieo-dmm-customer-result {
    margin-top: 14px;
    padding: 12px;
    background: #f4f8fb;
    border-radius: 6px;
}
.aieo-dmm-customer-result img {
    max-width: 120px;
    float: left;
    margin-right: 12px;
}

/* --------------------------------------------------------------------------
 *  Select2 overrides — sized to match our inputs
 * -------------------------------------------------------------------------- */

/* When Select2 enhances a <select>, it adds .select2-hidden-accessible to
 * the original element. Our generic .aieo-dmm-form select rule above was
 * overriding Select2's own hiding CSS and leaving the native multi-select
 * listbox visible alongside the Select2 widget. Re-assert the hiding with
 * higher specificity + !important. */
.aieo-dmm-form select.select2-hidden-accessible,
select.select2-hidden-accessible {
    position: absolute !important;
    clip: rect(0 0 0 0) !important;
    width: 1px !important;
    min-height: 0 !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    white-space: nowrap !important;
}

/* Hard reset — strips any border/padding/background other plugins may have
 * attached to our specific Select2 containers so only the inner
 * .select2-selection element carries the visible chrome. This kills the
 * "ghost empty box above the picker" reported on Brand/Category/Product
 * multi-selects. */
.aieo-dmm-form .select2-container,
.aieo-dmm-form .select2-container.select2-container--default {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    vertical-align: top !important;
    min-height: 0 !important;
}
.aieo-dmm-form .select2-container .select2-selection__rendered,
.aieo-dmm-form .select2-container .select2-selection__choice__display {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}
/* Only the .select2-selection (single or multiple) gets the visible border. */
.aieo-dmm-form .select2-container--default .select2-selection {
    box-sizing: border-box;
}

/* ----------------------------------------------------------------------
 * CRITICAL Select2 fallback styling
 *
 * WordPress admin on some installs registers the select2 SCRIPT handle
 * but not a matching STYLE handle, so our JS attaches Select2 without
 * its stylesheet loading. The widget's own DOM is valid (one container,
 * one bordered selection, one <ul> with the search <input>) but without
 * CSS the <ul> falls to its own line beneath an empty selection box —
 * that's the "two stacked boxes" the operator was seeing.
 *
 * These rules re-assert ONE unified box: flex row, chips + search input
 * inline, single border, no phantom vertical split. Applies only inside
 * our .aieo-dmm-form scope so we don't touch other plugins' Select2.
 * ---------------------------------------------------------------------- */
.aieo-dmm-form .select2-container--default .select2-selection--multiple {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    min-height: 36px;
    padding: 4px 6px !important;
    border: 1px solid #cbd5d9 !important;
    border-radius: 6px !important;
    background: #fff !important;
    cursor: text;
    box-sizing: border-box;
}
.aieo-dmm-form .select2-container--default .select2-selection--multiple
    .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
    width: 100%;
    box-sizing: border-box;
}
.aieo-dmm-form .select2-container--default .select2-selection--multiple
    .select2-selection__rendered > li {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
    list-style: none !important;
}
.aieo-dmm-form .select2-container--default .select2-selection--multiple
    .select2-selection__rendered > li::before {
    content: none !important;
}
.aieo-dmm-form .select2-container--default .select2-search--inline {
    flex: 1 1 auto;
    min-width: 120px;
}
.aieo-dmm-form .select2-container--default .select2-search--inline
    .select2-search__field {
    border: 0 !important;
    background: transparent !important;
    outline: none !important;
    padding: 4px 6px !important;
    margin: 0 !important;
    font-size: 13px !important;
    min-height: 28px !important;
    box-shadow: none !important;
    font-family: inherit !important;
}
.aieo-dmm-form .select2-container--default .select2-selection__choice {
    background: #f11569 !important;
    color: #fff !important;
    border: 0 !important;
    padding: 2px 10px 2px 6px !important;
    border-radius: 14px !important;
    font-size: 12px !important;
    line-height: 1.6 !important;
    margin: 2px 0 !important;
}
.aieo-dmm-form .select2-container--default .select2-selection__choice__remove {
    color: #fff !important;
    margin-right: 6px;
    margin-left: 0;
    border: 0 !important;
    background: transparent !important;
    font-weight: 700;
    cursor: pointer;
}
.aieo-dmm-form .select2-container--default .select2-selection__choice__remove:hover {
    color: #fff !important;
    background: rgba(0, 0, 0, 0.15) !important;
}

/* Single-select variant — also force a single-row box. */
.aieo-dmm-form .select2-container--default .select2-selection--single {
    display: flex !important;
    align-items: center;
    height: 36px !important;
    padding: 0 10px !important;
    border: 1px solid #cbd5d9 !important;
    border-radius: 6px !important;
    background: #fff !important;
    box-sizing: border-box;
}
.aieo-dmm-form .select2-container--default .select2-selection--single
    .select2-selection__rendered {
    padding: 0 !important;
    margin: 0 !important;
    line-height: 34px !important;
    color: #2c3338;
    width: 100%;
}
.aieo-dmm-form .select2-container--default .select2-selection--single
    .select2-selection__arrow {
    height: 34px !important;
}

/* Dropdown panel — always on top, solid white, tight rows, floating
 * (position:absolute so it overlays page flow instead of pushing later
 * fields down). Select2 appends .select2-dropdown to <body> when open, so
 * these rules are NOT scoped to .aieo-dmm-form. */
.select2-container--open.select2-container--default {
    z-index: 100010;
}
.select2-container--open.select2-container--default .select2-dropdown {
    background: #fff !important;
    border: 1px solid #cbd5d9 !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14) !important;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
}
/* The wrapper Select2 injects inside the widget container — it should be
 * invisible and have no layout impact. Some installs saw it reserving a
 * thin strip of vertical space. */
.select2-container .dropdown-wrapper {
    display: none !important;
    height: 0 !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}
/* .select2-results is the wrapper around the options — strip padding/margin
 * so there's no empty strip between the top border and the first row or
 * the "No results found" message. */
.select2-container--open.select2-container--default .select2-results {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
}

/* The <ul> that holds the results — strip all browser defaults. */
.select2-container--open.select2-container--default .select2-results > .select2-results__options {
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
    max-height: 320px;
    overflow-y: auto;
}
/* Each result item — tight row, flush, no bullet, no inter-row gap. */
.select2-container--open.select2-container--default .select2-results__option {
    display: block !important;
    padding: 4px 12px !important;
    margin: 0 !important;
    line-height: 1.3 !important;
    font-size: 13px !important;
    list-style: none !important;
    color: #2c3338 !important;
    background: #fff !important;
    border: 0 !important;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.select2-container--open.select2-container--default .select2-results__option + .select2-results__option {
    border-top: 0 !important;
    margin-top: 0 !important;
}
.select2-container--open.select2-container--default .select2-results__option::before {
    content: none !important;
}
/* Hovered / keyboard-highlighted item. */
.select2-container--open.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--open.select2-container--default .select2-results__option--highlighted {
    background: #f11569 !important;
    color: #fff !important;
}
/* Already-selected item (grey). */
.select2-container--open.select2-container--default .select2-results__option[aria-selected="true"] {
    background: #f4f4f4 !important;
    color: #2c3338 !important;
}
.select2-container--open.select2-container--default .select2-results__option[aria-selected="true"].select2-results__option--highlighted {
    background: #f11569 !important;
    color: #fff !important;
}
/* Empty-result / searching-for-more messages — same tight padding as rows. */
.select2-container--open.select2-container--default .select2-results__message {
    background: #fff !important;
    color: #6b7280 !important;
    padding: 6px 12px !important;
    margin: 0 !important;
    font-style: italic;
    line-height: 1.3 !important;
}
/* Search box at the top of single-select dropdowns. */
.select2-container--open.select2-container--default .select2-search--dropdown {
    padding: 6px !important;
    background: #fafbfc;
    border-bottom: 1px solid #eef0f3;
}
.select2-container--open.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #cbd5d9 !important;
    border-radius: 4px !important;
    padding: 5px 8px !important;
    font-size: 13px !important;
    width: 100% !important;
    box-sizing: border-box;
}
/* Focused state (applies to both single and multiple). All other
 * .select2-selection-* properties are now set by the "Critical Select2
 * fallback" block above — DO NOT re-declare border/padding/min-height
 * here without !important, otherwise the cascade wipes out the flex
 * layout and the widget splits into two stacked boxes. */
.aieo-dmm-form .select2-container--default.select2-container--focus
    .select2-selection--multiple,
.aieo-dmm-form .select2-container--default.select2-container--focus
    .select2-selection--single {
    border-color: #f11569 !important;
    box-shadow: 0 0 0 2px rgba(241, 21, 105, 0.15) !important;
}

/* (The older `.aieo-dmm-select2-open` rule block was removed — it used a
 *  non-existent class and was duplicating the rules already defined in
 *  the "Dropdown panel" block above using `.select2-container--open`.
 *  Keeping this stub comment so future edits don't accidentally re-add
 *  the same rules.) */

/* --------------------------------------------------------------------------
 *  Callout + bulleted "how it works" list (reused across subtabs).
 * -------------------------------------------------------------------------- */
.aieo-dmm-callout {
    background: #fff7ed;
    border-left: 4px solid #f59e0b;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #4b3a17;
}
.aieo-dmm-callout strong { color: #92400e; }

.aieo-dmm-bullets {
    list-style: disc;
    margin: 8px 0 0 20px;
    padding: 0;
}
.aieo-dmm-bullets > li {
    margin: 0 0 10px;
    color: #374151;
    line-height: 1.55;
}
.aieo-dmm-bullets > li strong { color: #101517; }

/* --------------------------------------------------------------------------
 *  Attribution tab (DMM → Attribution)
 * -------------------------------------------------------------------------- */
.aieo-attr-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 6px 0 4px;
}
.aieo-attr-tile {
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    position: relative;
}
.aieo-attr-tile-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    /* Use plain block + inline flow (NOT flex) so the help icon stays
       at the end of the last line of the title text — even when the
       title wraps onto multiple lines. The previous flex layout
       pushed the icon onto its own row whenever the title wrapped.
       overflow-wrap: anywhere keeps long all-caps table names like
       WP_AIEO_CUSTOMER_INTELLIGENCE inside the tile. */
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}
.aieo-attr-tile-label > span:first-child {
    display: inline;
    margin-right: 4px;
}
.aieo-attr-tile-label > .aieo-attr-tile-help {
    /* Force the icon to flow inline with the title text. */
    vertical-align: middle;
}
.aieo-attr-tile-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e4e4e7;
    color: #6b7280;
    font-size: 10px;
    font-weight: 700;
    cursor: help;
    text-transform: none;
    line-height: 1;
    user-select: none;
}
.aieo-attr-tile-help:hover { background: #c084fc; color: #fff; }
.aieo-attr-tile-popover {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    padding: 10px 12px;
    background: #1f2937;
    color: #f9fafb;
    font-size: 12px;
    line-height: 1.45;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    z-index: 10;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    white-space: normal;
}
.aieo-attr-tile:hover .aieo-attr-tile-popover { display: block; }
.aieo-attr-tile-popover::before {
    content: "";
    position: absolute;
    top: -5px;
    left: 16px;
    width: 10px;
    height: 10px;
    background: #1f2937;
    transform: rotate(45deg);
}
.aieo-attr-tile-value {
    font-size: 22px;
    font-weight: 600;
    color: #111827;
    margin-top: 4px;
    line-height: 1.2;
}

/* Status pills for the detail table */
.aieo-attr-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}
.aieo-attr-pill-ok   { background: #dcfce7; color: #166534; }
.aieo-attr-pill-ok a { color: #166534; text-decoration: underline; }
.aieo-attr-pill-warn { background: #fef3c7; color: #92400e; }

/* Detail DataTable — toolbar + body + footer/pager */
.aieo-attr-detail-table { display: flex; flex-direction: column; gap: 10px; }
.aieo-attr-dt-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.aieo-attr-dt-toolbar .spacer { flex: 1; }
.aieo-attr-dt-search {
    min-width: 280px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}
.aieo-attr-dt-perpage,
.aieo-attr-dt-toolbar label select {
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
}
.aieo-attr-dt-body {
    min-height: 60px;
    transition: opacity 120ms ease;
}
.aieo-attr-dt-empty {
    padding: 24px;
    text-align: center;
    color: #6b7280;
    background: #f9fafb;
    border: 1px dashed #e5e7eb;
    border-radius: 6px;
}
.aieo-attr-dt-table thead th.sortable,
.aieo-attr-sortable-table thead th[data-sort-type] {
    cursor: pointer;
    user-select: none;
}
.aieo-attr-dt-table thead th.sortable:hover,
.aieo-attr-sortable-table thead th[data-sort-type]:hover { background: #f3f4f6; }
.aieo-attr-dt-table thead th.sorted-asc,
.aieo-attr-dt-table thead th.sorted-desc,
.aieo-attr-sortable-table thead th.sorted-asc,
.aieo-attr-sortable-table thead th.sorted-desc { color: #1f2937; }
.aieo-attr-dt-sort-ind {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    color: #9ca3af;
}
.aieo-attr-dt-table thead th.sorted-asc .aieo-attr-dt-sort-ind,
.aieo-attr-dt-table thead th.sorted-desc .aieo-attr-dt-sort-ind,
.aieo-attr-sortable-table thead th.sorted-asc .aieo-attr-dt-sort-ind,
.aieo-attr-sortable-table thead th.sorted-desc .aieo-attr-dt-sort-ind {
    color: #4f46e5;
}
.aieo-attr-dt-footer {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}
.aieo-attr-dt-summary {
    color: #6b7280;
    font-size: 12px;
}
.aieo-attr-dt-pager {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
}
.aieo-attr-dt-pager button {
    min-width: 30px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #1f2937;
    border-radius: 4px;
    cursor: pointer;
}
.aieo-attr-dt-pager button:hover:not(:disabled) { background: #f3f4f6; }
.aieo-attr-dt-pager button.is-current {
    background: #4f46e5;
    border-color: #4338ca;
    color: #fff;
    font-weight: 600;
}
.aieo-attr-dt-pager button:disabled {
    color: #d1d5db;
    cursor: not-allowed;
}
.aieo-attr-dt-gap {
    padding: 4px 2px;
    color: #9ca3af;
}

/* --------------------------------------------------------------------------
 *  WordPress color-picker overrides — DMM admin pages.
 *  Targets the actual rendered button:
 *    <button class="button wp-color-result">
 *      <span class="wp-color-result-text">Select Color</span>
 *    </button>
 *  WP's default styling fills the button with grey (`.button`) and adds a
 *  vertical separator (border-left on `.wp-color-result-text`) between the
 *  swatch and the label. Both removed so the button reads as one clean pill.
 *  Scoped to .aieo-dmm-section so we don't leak into core WP color pickers
 *  on unrelated admin pages.
 * -------------------------------------------------------------------------- */
.aieo-dmm-section .wp-color-result.button,
.aieo-dmm-form    .wp-color-result.button {
    /* DO NOT override `background` — wp-color-picker sets the selected swatch
       colour INLINE on this button; a transparent background here hid every
       swatch on every DMM colour picker. Only flatten the box-shadow. */
    box-shadow: none !important;
}
.aieo-dmm-section .wp-color-result.button:hover,
.aieo-dmm-section .wp-color-result.button:focus,
.aieo-dmm-form    .wp-color-result.button:hover,
.aieo-dmm-form    .wp-color-result.button:focus {
    box-shadow: 0 0 0 1px #c084fc !important;
}
/* Keep the "Select Color" label readable on ANY swatch colour (incl. dark
   ones) by giving the label span its own translucent light backdrop instead
   of the old transparent + grey text that vanished on dark swatches. */
.aieo-dmm-section .wp-color-result-text,
.aieo-dmm-form    .wp-color-result-text {
    border-left: 0 !important;
    background: rgba(255, 255, 255, 0.85) !important;
    color: #1f2937 !important;
}

/* --------------------------------------------------------------------------
 * Sectioned dropdowns (Storefront Display, etc.)
 *
 * When a group registers sections via AIEO_DMM::get_section_definitions(),
 * the panel emits a `.has-sections` class on the menu and one
 * `.aieo-dmm-subtab-menu-section` divider per non-default section.
 * The first section divider has its top margin reset so the panel
 * doesn't get an awkward leading gap.
 * -------------------------------------------------------------------------- */
/* --------------------------------------------------------------------------
 * Mega-menu layout — sectioned panels (currently the Storefront Display
 * group with 25+ modules across 3 sections) render as a grid of columns
 * instead of one tall stack. Each section becomes a `.aieo-dmm-subtab-menu-column`
 * with a coloured header + its items below.
 *
 * `repeat(auto-fit, minmax(180px, 1fr))` lets the grid auto-collapse on
 * narrow viewports (admin sidebar collapsed → less header width) without
 * any media-query gymnastics.
 * -------------------------------------------------------------------------- */
.aieo-dmm-subtab-menu.has-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 4px 16px;
    padding: 14px 16px;
    /* Override the base `min-width:220px` to let the grid drive the size. */
    min-width: 0;
    /* Cap sized for FOUR columns (Storefront: Product Cards / PDP /
     * Discoverability / Checkout). Wider groups (e-Shop Insights, 6 sections)
     * wrap to a second row. */
    max-width: min(940px, calc(100vw - 60px));
}
.aieo-dmm-subtab-menu-column {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.aieo-dmm-subtab-menu-section {
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 8px 14px 6px;
    line-height: 1.2;
    user-select: none;
    pointer-events: none;
    /* Header gets a bottom border (per-section colour set below) instead
     * of a top border — works better as a column header than a divider. */
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: 4px;
}

/* Per-section title colours — three storefront sections each get a
 * distinct hue so the dropdown scans at a glance. The accent appears
 * on the header text + its bottom border so each column reads as its
 * own grouped list. */
.aieo-dmm-subtab-menu-section[data-section-id="product_cards"] {
    color: #4338ca;     /* indigo */
    border-bottom-color: rgba(67, 56, 202, 0.25);
}
.aieo-dmm-subtab-menu-section[data-section-id="pdp"] {
    color: #be185d;     /* rose — adjacent to brand pink without competing */
    border-bottom-color: rgba(190, 24, 93, 0.25);
}
.aieo-dmm-subtab-menu-section[data-section-id="discoverability"] {
    color: #047857;     /* emerald */
    border-bottom-color: rgba(4, 120, 87, 0.25);
}
.aieo-dmm-subtab-menu-section[data-section-id="checkout_handling"] {
    color: #c2410c;     /* orange — Storefront's 4th (Checkout) section */
    border-bottom-color: rgba(194, 65, 12, 0.25);
}

/* e-Shop Insights report links can be long (esp. the Greek titles) — let them
 * WRAP inside their column instead of overflowing into the neighbour. Scoped to
 * sectioned (multi-column) panels; flat single-column menus keep nowrap. */
.aieo-dmm-subtab-menu-column .aieo-dmm-subtab-menu-item {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.3;
}
.aieo-dmm-subtab-menu.has-sections .aieo-dmm-subtab-menu-section {
    white-space: normal;
}

/* e-Shop Insights — one accent colour per section title (six categories). */
.aieo-dmm-subtab-menu-section[data-section-id="stock_management"] {
    color: #b45309;     /* amber */
    border-bottom-color: rgba(180, 83, 9, 0.28);
}
.aieo-dmm-subtab-menu-section[data-section-id="behavioural"] {
    color: #4338ca;     /* indigo */
    border-bottom-color: rgba(67, 56, 202, 0.28);
}
.aieo-dmm-subtab-menu-section[data-section-id="sales_reports"] {
    color: #047857;     /* emerald */
    border-bottom-color: rgba(4, 120, 87, 0.28);
}
.aieo-dmm-subtab-menu-section[data-section-id="comparative_turnover"] {
    color: #be185d;     /* rose */
    border-bottom-color: rgba(190, 24, 93, 0.28);
}
.aieo-dmm-subtab-menu-section[data-section-id="stock_reordering"] {
    color: #0e7490;     /* cyan */
    border-bottom-color: rgba(14, 116, 144, 0.28);
}
.aieo-dmm-subtab-menu-section[data-section-id="helpers"] {
    color: #6d28d9;     /* violet */
    border-bottom-color: rgba(109, 40, 217, 0.28);
}
/* Catalog Sync — "Sync & Feeds" header (Stock Management reuses the amber
 * rule above). Green so the right column reads as its own grouped list. */
.aieo-dmm-subtab-menu-section[data-section-id="sync_feeds"] {
    color: #047857;     /* emerald green */
    border-bottom-color: rgba(4, 120, 87, 0.28);
}

/* =============================================================================
 * SEO → Content Opportunities
 * ========================================================================== */
.aieo-opp-intro { max-width: 880px; }
.aieo-opp-status { margin-left: 8px; font-size: 12px; color: #64748b; }

.aieo-opp-controls { margin: 14px 0; border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px 14px; background: #fff; }
.aieo-opp-controls > summary { cursor: pointer; font-weight: 600; }
.aieo-opp-controls-grid { display: flex; flex-wrap: wrap; gap: 18px; margin: 12px 0; }
.aieo-opp-fieldset { flex: 1 1 220px; min-width: 220px; border: 1px solid #e2e8f0; border-radius: 6px; padding: 8px 12px; }
.aieo-opp-fieldset legend { font-weight: 600; padding: 0 4px; }
.aieo-opp-hint { font-size: 11px; color: #64748b; margin: 2px 0 8px; }
.aieo-opp-fieldset label { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
.aieo-opp-fieldset input[type="number"] { width: 84px; }
.aieo-opp-fieldset label.aieo-opp-strong { font-weight: 700; }

.aieo-opp-chips { margin: 10px 0; }
.aieo-opp-table .aieo-opp-col-num { width: 92px; text-align: center; }
.aieo-opp-table .aieo-opp-col-quad { width: 130px; }
.aieo-opp-table .aieo-opp-col-pin { width: 90px; }
.aieo-opp-rec { font-size: 12px; color: #475569; }
.aieo-opp-num { font-size: 11px; color: #64748b; }

.aieo-opp-bar { display: block; background: #e2e8f0; border-radius: 4px; height: 8px; overflow: hidden; }
.aieo-opp-bar-fill { display: block; background: #7c3aed; height: 8px; width: 0; }

.aieo-opp-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.aieo-opp-q-hidden_gem { background: #dcfce7; color: #15803d; }
.aieo-opp-q-intent_mismatch { background: #fef3c7; color: #b45309; }
.aieo-opp-q-defend { background: #dbeafe; color: #1d4ed8; }
.aieo-opp-q-prune { background: #f1f5f9; color: #64748b; }

.aieo-opp-pin.is-pinned { color: #7c3aed; font-weight: 700; border-color: #7c3aed; }
.aieo-opp-excluded { display: block; font-size: 10px; color: #b91c1c; text-transform: uppercase; }

.aieo-opp-table .aieo-opp-col-act { width: 240px; }
.aieo-opp-apply-kp-row, .aieo-opp-apply-pri-row { display: flex; align-items: center; gap: 4px; margin: 2px 0; }
.aieo-opp-apply-kp-row .aieo-opp-kp { flex: 1 1 auto; min-width: 90px; }
.aieo-opp-apply-pri-row label { font-size: 11px; color: #64748b; display: flex; align-items: center; gap: 4px; }
.aieo-opp-apply-pri-row .aieo-opp-pri { width: 80px; }
.aieo-opp-suggest-out { font-size: 11px; margin: 2px 0; }
.aieo-opp-suggest-out .aieo-opp-term { display: inline-block; margin: 1px 6px 1px 0; padding: 1px 6px; background: #ede9fe; color: #6d28d9; border-radius: 8px; text-decoration: none; }
.aieo-opp-apply-status { font-size: 11px; color: #64748b; }
