/* Keep category controls in normal flow, including Nestable's dragged copy. */
.product-category-page .account-wrapper,
.product-category-page .account-box,
.product-category-page .form-body,
.product-category-page .fieldset,
.product-category-page .dd {
    min-width: 0;
    max-width: 100%;
}
.product-category-page .form-head-inner {
    gap: 12px;
}
.product-category-page .account-wrapper .account-box.is-form .form-head-inner > .left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.product-category-page .form-head-inner > .left h3,
.product-category-page .form-head-inner > .left p {
    margin: 0;
}
.product-category-page .form-head-inner > .left p:empty {
    display: none;
}
.product-category-page .form-head-inner > .right {
    min-width: 0;
}
.product-category-page .form-head .buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}
.product-category-page .form-head .buttons .button {
    height: 36px !important;
    min-height: 36px !important;
    margin: 0 !important;
    padding: 0 14px !important;
    border-radius: 999px !important;
    font-size: 14px;
    font-weight: 700;
}
.product-category-page #save_item_category {
    background: #ff596f;
    border-color: #ff596f;
    color: #fff;
}
.product-category-page .category-storefront-note {
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
}
.product-category-page .category-storefront-note strong {
    margin: 0 0 2px;
}
.dd-list .dd-item.category-tree-item {
    display: grid;
    grid-template-columns: 32px 32px minmax(0, 1fr) 36px 36px max-content 50px 36px;
    grid-template-areas: "drag edit name content seo link visibility delete" "children children children children children children children children";
    align-items: center;
    column-gap: 6px;
    row-gap: 0;
    margin: 0 !important;
    padding: 2px 0 !important;
    border: 0 !important;
    border-top: 1px solid #adb8ca !important;
    min-width: 0;
    min-height: 0 !important;
    background: #fff;
}
.category-tree-item > .dd-title {
    grid-area: name;
    min-width: 0;
    margin: 0;
    padding: 0;
    line-height: 1.35;
    overflow-wrap: anywhere;
    color: #28344f;
}
.dd-list .category-tree-item > .dd3-handle {
    grid-area: drag;
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px !important;
    height: 32px !important;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    text-indent: 0;
    color: #fff;
    cursor: grab;
    touch-action: none;
}
.dd-list .category-tree-item > .dd3-handle:active {
    cursor: grabbing;
}
.dd-list .category-tree-item > .dd3-handle > i {
    font-size: 16px;
    line-height: 1;
}
.dd-list .category-tree-item > .dd3-handle::before {
    display: none;
}
.category-tree-item > .edit_cate_menu { grid-area: edit; }
.category-tree-item > .category_show_edit {
    grid-area: content;
    height: 28px;
}
.category-tree-item > .category-seo-edit { grid-area: seo; }
.category-tree-item > .category-store-link { grid-area: link; }
.category-tree-item > .del_cate_menu { grid-area: delete; }
.category-tree-item > a {
    position: static !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    float: none;
    min-width: 0;
    width: 36px;
    height: 32px;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 50%;
    color: #d94660;
}
.category-tree-item > a:hover {
    background: #fff1f4;
}
.category-tree-item > a:focus-visible {
    outline: 2px solid #ff596f;
    outline-offset: 1px;
}
.category-tree-item > .category-store-link {
    width: auto;
    height: 24px;
    gap: 5px;
    padding: 0 8px !important;
    border-radius: 999px;
    background: #f5f6f9;
    color: #687388;
    font-size: 11px;
    white-space: nowrap;
}
.category-tree-item > .category-seo-edit {
    justify-self: center;
    width: 28px !important;
    height: 28px;
    border-radius: 50%;
    background: #f3f5f8;
    color: #56627a;
}
.category-tree-item > .category-visibility {
    grid-area: visibility;
    position: static !important;
    justify-self: center;
    width: 50px;
}
.category-tree-item .category-visibility .form-switch {
    display: flex;
    align-items: center;
    margin: 0 !important;
    height: 28px;
    padding: 0;
}
.dd-list .category-tree-item > .dd-list {
    grid-area: children;
    margin: 2px 0 -2px !important;
    padding: 0 0 0 20px !important;
    min-width: 0;
    border-left: 1px solid #adb8ca;
}
@media (max-width: 1024px) {
    .dd-list .dd-item.category-tree-item {
        grid-template-columns: 32px 32px minmax(0, 1fr) 32px 32px 50px;
        grid-template-areas: "drag edit name name name delete" "link link link content seo visibility" "children children children children children children";
        column-gap: 4px;
        row-gap: 0;
    }
    .dd-list .category-tree-item > .dd3-handle,
    .category-tree-item > a:not(.category-store-link):not(.category-seo-edit) {
        width: 32px !important;
    }
    .category-tree-item > .del_cate_menu {
        justify-self: center;
    }
    .category-tree-item > .category-store-link {
        justify-self: start;
    }
    .dd-list .category-tree-item > .dd-list {
        padding-left: 10px !important;
    }
}
@media (max-width: 767px) {
    .product-category-page .account-wrapper {
        padding-top: 0;
    }
    .product-category-page .account-box .form-head,
    .product-category-page .account-box .form-head.is-stuck {
        position: static !important;
        width: auto !important;
        padding: 12px !important;
    }
    .product-category-page .form-head-inner {
        flex-direction: column;
        align-items: stretch !important;
    }
    .product-category-page .form-head-inner > .right {
        width: 100%;
        margin: 0;
    }
    .product-category-page .form-head .buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .product-category-page .account-box .form-body {
        padding: 12px !important;
    }
    .product-category-page .form-body > .fieldset {
        max-width: none !important;
        padding: 0 !important;
    }
}


/* One-click category repair: compact controls and a single title/subtitle group. */
.category-ancestor-repair-modal .modal-content { width: min(560px, calc(100vw - 32px)); max-width: calc(100vw - 32px); }
.category-ancestor-repair-modal .modal-card { border-radius: 14px; overflow: hidden; }
.category-ancestor-repair-modal .modal-card-head { display: flex; align-items: center; gap: 12px; background: #fff; padding: 18px 20px; }
.category-ancestor-repair-modal .category-repair-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; text-align: left; }
.category-ancestor-repair-modal .category-repair-heading h3, .category-ancestor-repair-modal .category-repair-heading p { margin: 0 !important; }
.category-ancestor-repair-modal .category-repair-heading h3 { font-size: 18px; font-weight: 700; color: #28344f; }
.category-ancestor-repair-modal .category-repair-heading p { font-size: 12px; line-height: 1.4; color: #69758d; }
.category-ancestor-repair-modal .category-repair-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 32px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f4f5f7; color: #526078; cursor: pointer; }
.category-ancestor-repair-modal .modal-card-body { padding: 16px 20px; background: #fff; }
.category-ancestor-repair-modal .category-repair-explanation { margin: 0 0 14px; line-height: 1.6; font-size: 13px; color: #69758d; }
.category-ancestor-repair-modal #category-repair-summary { font-size: 14px; font-weight: 700; line-height: 1.6; color: #28344f; overflow-wrap: anywhere; }
.category-ancestor-repair-modal #category-repair-details { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: #69758d; }
.category-ancestor-repair-modal #category-repair-details:empty { display: none; }
.category-ancestor-repair-modal progress { height: 8px; margin: 12px 0 0; }
.category-ancestor-repair-modal .modal-card-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 20px; background: #fff; }
.category-ancestor-repair-modal .modal-card-foot .button { height: 36px !important; min-height: 36px !important; border-radius: 999px !important; font-size: 14px; font-weight: 700; margin: 0; padding: 0 18px; }
.category-ancestor-repair-modal #category-repair-confirm { background: #ff596f; border-color: #ff596f; color: #fff; }
.category-ancestor-repair-modal [hidden] { display: none !important; }
.category-ancestor-repair-modal button:focus-visible { outline: 2px solid #ff596f; outline-offset: 2px; }
@media (max-width: 767px) {
    .product-category-page .form-head-inner { align-items: flex-start; flex-wrap: wrap; }
    .product-category-page .form-head-inner > .right { width: 100%; }
    .category-ancestor-repair-modal .modal-card-head, .category-ancestor-repair-modal .modal-card-body, .category-ancestor-repair-modal .modal-card-foot { padding-left: 16px; padding-right: 16px; }
}
