.toprest-product-group-note-host:empty { display: none; }
.toprest-product-group-note-host.is-visible { display: block; }
.toprest-product-group-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 10px 0 14px;
    padding: 11px 13px;
    border: 1px solid #cfe7ef;
    border-radius: 13px;
    background: #f4fbfd;
    color: #1d3f74;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.75;
    direction: rtl;
}
.toprest-cart-groups {
    display: grid;
    gap: 13px;
    clear: both;
    margin: 18px 0 24px;
    padding: 15px;
    border: 1px solid #d9e8ed;
    border-radius: 18px;
    background: #f8fbfc;
    color: #173a65;
    direction: rtl;
    text-align: right;
}
.toprest-cart-groups__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 2px 8px;
}
.toprest-cart-groups__heading span {
    display: block;
    margin-bottom: 2px;
    color: #5f7485;
    font-size: 12px;
    font-weight: 800;
}
.toprest-cart-groups__heading h2 { margin: 0 0 4px; color: #1d3f74; font-size: 20px; line-height: 1.35; }
.toprest-cart-groups__heading p { margin: 0; max-width: 760px; color: #607687; font-size: 13px; line-height: 1.7; }
.toprest-cart-groups__heading > strong {
    flex: 0 0 auto;
    padding: 8px 11px;
    border-radius: 999px;
    background: #fff4d8;
    color: #8a5a00;
    font-size: 12px;
}
.toprest-cart-groups[data-toprest-cart-valid="1"] .toprest-cart-groups__heading > strong { background: #e7f7ef; color: #147a4f; }
.toprest-cart-group {
    overflow: hidden;
    padding: 14px;
    border: 1px solid #dde9ed;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(27,61,98,.04);
}
.toprest-cart-group.is-incomplete { border-color: #efd6a4; background: #fffdf8; }
.toprest-cart-group.is-complete { border-color: #cfe8da; }
.toprest-cart-group__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toprest-cart-group__top h3 { margin: 3px 0 0; color: #173a65; font-size: 16px; line-height: 1.4; }
.toprest-cart-group__top p { margin: 2px 0 0; color: #718391; font-size: 12px; }
.toprest-cart-group__state { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: #fff0d7; color: #9b5f00; font-size: 11px; font-weight: 800; }
.toprest-cart-group.is-complete .toprest-cart-group__state { background: #e7f7ef; color: #147a4f; }
.toprest-cart-group__count { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.toprest-cart-group__count b { color: #1d3f74; font-size: 23px; }
.toprest-cart-group__count span { color: #667b8c; font-size: 12px; }
.toprest-cart-group__progress { height: 7px; margin: 12px 0; overflow: hidden; border-radius: 99px; background: #e9f0f3; }
.toprest-cart-group__progress i { display: block; height: 100%; border-radius: inherit; background: #e2a128; transition: width .2s ease; }
.toprest-cart-group.is-complete .toprest-cart-group__progress i { background: #36a66f; }
.toprest-cart-group__message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 11px;
    border-radius: 11px;
    background: #fff5df;
    color: #725020;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.75;
}
.toprest-cart-group__message.is-success { background: #eef9f3; color: #176b49; }
.toprest-group-suggestions { margin-top: 13px; }
.toprest-group-suggestions__title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.toprest-group-suggestions__title strong { color: #1d3f74; font-size: 13px; }
.toprest-group-suggestions__title span { color: #6c7f8e; font-size: 11px; }
.toprest-group-suggestions__grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: 9px; }
.toprest-suggestion-card {
    display: grid;
    grid-template-columns: 58px minmax(0,1fr);
    align-items: center;
    gap: 9px;
    min-width: 0;
    padding: 8px;
    border: 1px solid #dbe8ed;
    border-radius: 12px;
    background: #fff;
    color: inherit;
    text-decoration: none !important;
    transition: border-color .16s ease, transform .16s ease;
}
.toprest-suggestion-card:hover { border-color: #7cb8c7; transform: translateY(-1px); }
.toprest-suggestion-card__image { display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border-radius: 9px; background: #f6f9fa; }
.toprest-suggestion-card__image img { width: 100%; height: 100%; object-fit: contain; margin: 0; }
.toprest-suggestion-card__body { display: grid; min-width: 0; gap: 2px; }
.toprest-suggestion-card__body strong { overflow: hidden; color: #173a65; font-size: 12px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.toprest-suggestion-card__body small { color: #168276; font-size: 11px; font-weight: 800; }
.toprest-suggestion-card__body em { color: #637989; font-size: 10px; font-style: normal; }
.toprest-mini-cart-groups { display: grid; gap: 7px; margin: 8px 10px 12px; direction: rtl; }
.toprest-mini-cart-groups > div { display: flex; align-items: flex-start; gap: 7px; padding: 9px 10px; border: 1px solid #eed8aa; border-radius: 11px; background: #fff9eb; color: #6f501f; font-size: 12px; font-weight: 700; line-height: 1.65; }
.toprest-checkout-disabled { opacity: .58 !important; cursor: not-allowed !important; filter: grayscale(.18); }
.toprest-checkout-blocked-message { margin-top: 8px; padding: 9px 11px; border: 1px solid #efc7bd; border-radius: 10px; background: #fff5f2; color: #9c3427; font-size: 12px; font-weight: 800; line-height: 1.65; direction: rtl; }

/* Admin: central source-city rules. */
.toprest-group-rules-admin .toprest-group-rule-table-wrap { overflow: auto; max-width: 100%; }
.toprest-group-rules-admin .toprest-group-rule-table { min-width: 1120px; }
.toprest-group-rules-admin .toprest-group-rule-table input[type="text"],
.toprest-group-rules-admin .toprest-group-rule-table input[type="number"],
.toprest-group-rules-admin .toprest-group-rule-table textarea { width: 100%; min-width: 86px; }
.toprest-group-rules-admin .toprest-group-rule-table textarea { min-width: 190px; resize: vertical; }
.toprest-group-rule-fields { margin-top: 4px; padding: 13px; border: 1px solid #cfe3ea; border-radius: 12px; background: #f5fbfd; }
.toprest-group-rule-fields > strong { display: block; margin-bottom: 10px; color: #1d3f74; }
.toprest-group-rule-fields > strong small { color: #657c8c; font-weight: 500; }
.toprest-group-rule-fields > small { display: block; margin: -5px 0 10px; color: #657c8c; line-height: 1.65; }
.toprest-offers-table-wrap { overflow: auto; max-width: 100%; }
.toprest-group-products summary { cursor: pointer; color: #1d3f74; font-weight: 800; }
.toprest-group-products ul { margin: 8px 0 0; padding: 0 18px 0 0; max-height: 180px; overflow: auto; }
.toprest-group-products li { margin: 3px 0; color: #536b7b; font-size: 12px; line-height: 1.55; }
.toprest-rule-tools { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 12px 0; padding: 10px; border: 1px solid #dbe8ed; border-radius: 12px; background: #f8fbfc; }
.toprest-rule-tools label { flex: 1 1 420px; font-weight: 800; }
.toprest-rule-tools input { display: block; width: 100%; max-width: 620px; margin-top: 5px; }
.toprest-rule-tools span { flex: 0 0 auto; color: #5d7383; font-size: 12px; font-weight: 800; }


@media (max-width: 1100px) {
    .toprest-group-rules-admin .toprest-group-rule-table,
    .toprest-offers-table { min-width: 0; }
    .toprest-group-rules-admin .toprest-group-rule-table thead,
    .toprest-offers-table thead { display: none; }
    .toprest-group-rules-admin .toprest-group-rule-table,
    .toprest-group-rules-admin .toprest-group-rule-table tbody,
    .toprest-group-rules-admin .toprest-group-rule-table tr,
    .toprest-group-rules-admin .toprest-group-rule-table td,
    .toprest-offers-table,
    .toprest-offers-table tbody,
    .toprest-offers-table tr,
    .toprest-offers-table td { display: block; width: 100%; box-sizing: border-box; }
    .toprest-group-rules-admin .toprest-group-rule-table tr,
    .toprest-offers-table tr { margin-bottom: 12px; padding: 10px; border: 1px solid #dbe7ec; border-radius: 12px; background: #fff; }
    .toprest-group-rules-admin .toprest-group-rule-table td,
    .toprest-offers-table td { display: grid; grid-template-columns: minmax(120px,32%) minmax(0,1fr); align-items: center; gap: 9px; padding: 7px 0; border: 0; }
    .toprest-group-rules-admin .toprest-group-rule-table td::before,
    .toprest-offers-table td::before { content: attr(data-label); color: #536b7b; font-size: 12px; font-weight: 800; }
    .toprest-group-rules-admin .toprest-group-rule-table textarea { min-width: 0; }
}
@media (max-width: 782px) {
    .toprest-rule-tools { align-items: stretch; flex-direction: column; }
    .toprest-rule-tools label { flex-basis: auto; }
    .toprest-cart-groups { margin: 14px 0 20px; padding: 11px; border-radius: 15px; }
    .toprest-cart-groups__heading { align-items: flex-start; flex-direction: column; gap: 9px; }
    .toprest-cart-groups__heading h2 { font-size: 18px; }
    .toprest-cart-groups__heading > strong { align-self: stretch; text-align: center; }
    .toprest-cart-group { padding: 11px; }
    .toprest-cart-group__count b { font-size: 20px; }
    .toprest-group-suggestions__title { align-items: flex-start; flex-direction: column; }
    .toprest-group-suggestions__grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .toprest-suggestion-card { grid-template-columns: 48px minmax(0,1fr); padding: 7px; }

    .toprest-group-rules-admin .toprest-group-rule-table { min-width: 0; }
    .toprest-group-rules-admin .toprest-group-rule-table thead { display: none; }
    .toprest-group-rules-admin .toprest-group-rule-table,
    .toprest-group-rules-admin .toprest-group-rule-table tbody,
    .toprest-group-rules-admin .toprest-group-rule-table tr,
    .toprest-group-rules-admin .toprest-group-rule-table td { display: block; width: 100%; box-sizing: border-box; }
    .toprest-group-rules-admin .toprest-group-rule-table tr { margin-bottom: 12px; padding: 10px; border: 1px solid #dbe7ec; border-radius: 12px; background: #fff; }
    .toprest-group-rules-admin .toprest-group-rule-table td { display: grid; grid-template-columns: minmax(95px,34%) minmax(0,1fr); align-items: center; gap: 9px; padding: 7px 0; border: 0; }
    .toprest-group-rules-admin .toprest-group-rule-table td::before { content: attr(data-label); color: #536b7b; font-size: 12px; font-weight: 800; }
    .toprest-group-rules-admin .toprest-group-rule-table textarea { min-width: 0; }
}
@media (max-width: 480px) {
    .toprest-cart-group__top { align-items: flex-start; }
    .toprest-cart-group__count { flex-direction: column; align-items: flex-end; gap: 0; }
    .toprest-group-suggestions__grid { grid-template-columns: 1fr; }
    .toprest-group-rules-admin .toprest-group-rule-table td { grid-template-columns: 1fr; gap: 4px; }
}

/* Admin workflow refinements — 6.0.0 */
.toprest-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}
.toprest-section-heading h2 { margin: 0 0 5px; }
.toprest-section-heading p { margin: 0; color: #607687; line-height: 1.7; }
.toprest-section-heading > strong {
    flex: 0 0 auto;
    padding: 7px 11px;
    border-radius: 999px;
    background: #edf7fa;
    color: #1d3f74;
    font-size: 12px;
}
.toprest-unconfigured-notice { padding-bottom: 9px; }
.toprest-unconfigured-notice details { margin: 7px 0 3px; }
.toprest-unconfigured-notice summary { cursor: pointer; color: #7b5400; font-weight: 800; }
.toprest-unconfigured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(230px,1fr));
    gap: 10px;
    margin-top: 12px;
}
.toprest-unconfigured-grid article {
    padding: 11px;
    border: 1px solid #ead49b;
    border-radius: 10px;
    background: #fffdf7;
}
.toprest-unconfigured-grid article > strong,
.toprest-unconfigured-grid article > span { display: block; }
.toprest-unconfigured-grid article > span { margin-top: 2px; color: #6e6250; font-size: 12px; }
.toprest-unconfigured-grid ul { max-height: 130px; margin: 8px 0 0; padding-right: 18px; overflow: auto; }
.toprest-unconfigured-grid li { margin: 3px 0; font-size: 12px; }
.toprest-rule-filter-grid,
.toprest-offer-filter-grid {
    display: grid;
    grid-template-columns: minmax(220px,2fr) repeat(4,minmax(145px,1fr)) auto;
    align-items: end;
    gap: 10px;
    margin: 12px 0;
    padding: 12px;
    border: 1px solid #dbe8ed;
    border-radius: 12px;
    background: #f8fbfc;
}
.toprest-rule-filter-grid label,
.toprest-offer-filter-grid label { display: block; font-weight: 800; }
.toprest-rule-filter-grid input,
.toprest-rule-filter-grid select,
.toprest-offer-filter-grid input,
.toprest-offer-filter-grid select { display: block; width: 100%; margin-top: 5px; }
.toprest-filter-actions { display: flex; gap: 7px; }
.toprest-bulk-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 11px 0;
    padding: 10px 12px;
    border: 1px solid #cfe0e7;
    border-radius: 11px;
    background: #f4f9fb;
}
.toprest-bulk-bar label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.toprest-bulk-bar input[type="checkbox"] { margin: 0; }
.toprest-bulk-bar select { min-width: 180px; }
.toprest-bulk-bar small { flex: 1 1 260px; color: #637989; line-height: 1.6; }
.toprest-priority-field input { width: 90px; margin-right: 5px; }
.toprest-sticky-save {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 -18px -18px;
    padding: 12px 18px;
    border-top: 1px solid #dbe8ed;
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(7px);
}
.toprest-sticky-save span { color: #607687; font-size: 12px; }
.toprest-group-rules-admin .toprest-group-rule-table { min-width: 1440px; }
.toprest-group-products li.is-inactive { opacity: .62; text-decoration: line-through; }
.toprest-group-products li em { margin-right: 5px; color: #5d7383; font-size: 10px; font-style: normal; text-decoration: none; }
.toprest-manage-products { margin-top: 7px !important; }
.toprest-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}
.toprest-status-pill.is-active { background: #e8f7ef; color: #147a4f; }
.toprest-status-pill.is-inactive { background: #f4f0ef; color: #8a4b3d; }

.toprest-unit-detection {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 155px;
    padding: 8px 10px;
    border: 1px solid #dce9ee;
    border-radius: 10px;
    background: #f8fbfc;
}
.toprest-unit-detection__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.toprest-unit-detection__top > strong {
    color: #173f58;
    font-size: 13px;
}
.toprest-unit-detection__top > span {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    background: #e8f7ef;
    color: #147a4f;
    font-size: 10px;
    font-weight: 800;
}
.toprest-unit-detection > small {
    color: #5d7383;
    font-size: 10px;
    line-height: 1.55;
}
.toprest-unit-detection.is-warning {
    border-color: #f2c98a;
    background: #fff8ea;
}
.toprest-unit-detection.is-warning .toprest-unit-detection__top > span {
    background: #ffe6b8;
    color: #8a5a00;
}
.toprest-unit-detection.is-review {
    border-color: #d9d4ea;
    background: #f7f5fc;
}
.toprest-unit-detection.is-review .toprest-unit-detection__top > span {
    background: #ece8f8;
    color: #5e4a8a;
}
.toprest-editor-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    color: #1d3f74;
}
.toprest-editor-summary span { color: #637989; font-size: 12px; font-weight: 500; }
.toprest-editor-summary + form { margin-top: 16px; }
.toprest-table-group-row td {
    position: sticky;
    top: 32px;
    z-index: 2;
    padding: 8px 12px !important;
    border-top: 1px solid #bcd5df;
    border-bottom: 1px solid #bcd5df !important;
    background: #eaf5f8;
    color: #1d3f74;
    font-weight: 800;
}
.toprest-offers-admin .toprest-offers-table { min-width: 1440px; }
.toprest-offer-list-card .tablenav { margin-top: 12px; }
body.toprest-modal-open { overflow: hidden; }
.toprest-admin-modal[hidden] { display: none !important; }
.toprest-admin-modal { position: fixed; inset: 0; z-index: 100100; display: grid; place-items: center; padding: 22px; }
.toprest-admin-modal__backdrop { position: absolute; inset: 0; background: rgba(15,35,50,.58); }
.toprest-admin-modal__dialog {
    position: relative;
    display: grid;
    grid-template-rows: auto auto minmax(180px,1fr) auto;
    width: min(760px,100%);
    max-height: min(760px,calc(100vh - 44px));
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(13,38,57,.3);
}
.toprest-admin-modal__dialog > header,
.toprest-admin-modal__dialog > footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #e0e9ed;
}
.toprest-admin-modal__dialog > footer { justify-content: flex-start; flex-wrap: wrap; border-top: 1px solid #e0e9ed; border-bottom: 0; }
.toprest-admin-modal__dialog header h2 { margin: 0 0 3px; color: #1d3f74; }
.toprest-admin-modal__dialog header p { margin: 0; color: #637989; }
.toprest-admin-modal__dialog header [data-close-modal] { color: #4c6576; font-size: 28px; line-height: 1; text-decoration: none; }
.toprest-modal-toolbar { display: flex; align-items: center; gap: 12px; padding: 11px 16px; background: #f7fafb; }
.toprest-modal-toolbar input[type="search"] { flex: 1 1 auto; }
.toprest-modal-toolbar label { white-space: nowrap; font-weight: 700; }
.toprest-modal-products-list { display: grid; align-content: start; gap: 8px; padding: 13px 16px; overflow: auto; }
.toprest-modal-product {
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border: 1px solid #dce8ed;
    border-radius: 11px;
    background: #fff;
}
.toprest-modal-product.is-inactive { background: #f8f7f6; opacity: .77; }
.toprest-modal-product span { display: grid; min-width: 0; gap: 2px; }
.toprest-modal-product strong { overflow: hidden; color: #173a65; text-overflow: ellipsis; white-space: nowrap; }
.toprest-modal-product small { color: #6b7e8c; }
.toprest-modal-product em { padding: 3px 7px; border-radius: 999px; background: #e8f7ef; color: #147a4f; font-size: 10px; font-style: normal; font-weight: 800; }
.toprest-modal-product.is-inactive em { background: #eee9e7; color: #8a4b3d; }
.toprest-empty-state { margin: 20px 0; color: #607687; text-align: center; }
#toprest-modal-status { color: #536b7b; font-weight: 700; }

@media (max-width: 1250px) {
    .toprest-rule-filter-grid,
    .toprest-offer-filter-grid { grid-template-columns: repeat(3,minmax(170px,1fr)); }
}
@media (max-width: 1100px) {
    .toprest-table-group-row { display: block !important; }
    .toprest-table-group-row td { position: static; display: block !important; width: auto !important; padding: 8px !important; }
    .toprest-table-group-row td::before { display: none !important; }
}
@media (max-width: 782px) {
    .toprest-section-heading { flex-direction: column; gap: 8px; }
    .toprest-section-heading > strong { align-self: stretch; text-align: center; }
    .toprest-rule-filter-grid,
    .toprest-offer-filter-grid { grid-template-columns: 1fr; }
    .toprest-filter-actions { width: 100%; }
    .toprest-filter-actions .button { flex: 1 1 0; text-align: center; }
    .toprest-bulk-bar { align-items: stretch; flex-direction: column; }
    .toprest-bulk-bar select,
    .toprest-bulk-bar .button { width: 100%; }
    .toprest-priority-field { justify-content: space-between; }
    .toprest-priority-field input { flex: 1 1 auto; width: auto; }
    .toprest-sticky-save { align-items: stretch; flex-direction: column; }
    .toprest-sticky-save .button { width: 100%; text-align: center; }
    .toprest-admin-modal { padding: 8px; }
    .toprest-admin-modal__dialog { max-height: calc(100vh - 16px); border-radius: 12px; }
    .toprest-modal-toolbar { align-items: stretch; flex-direction: column; }
    .toprest-admin-modal__dialog > footer { align-items: stretch; flex-direction: column; }
    .toprest-admin-modal__dialog > footer select,
    .toprest-admin-modal__dialog > footer .button { width: 100%; }
}

/* Smart proportional routing — 6.0.0 */
.toprest-cart-group__items {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: 0 0 11px;
}
.toprest-cart-group__items > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 6px 9px;
    border: 1px solid #dce8ed;
    border-radius: 999px;
    background: #f8fbfc;
}
.toprest-cart-group__items b {
    overflow: hidden;
    max-width: 360px;
    color: #254765;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.toprest-cart-group__items em {
    flex: 0 0 auto;
    color: #168276;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}
.toprest-remaining-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 9px;
    padding: 9px 10px;
    border: 1px dashed #e2c37e;
    border-radius: 11px;
    background: #fffaf0;
    color: #715020;
    font-size: 12px;
}
.toprest-remaining-options > strong { margin-left: 2px; }
.toprest-remaining-options > span {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff;
    box-shadow: inset 0 0 0 1px #ead7aa;
    font-weight: 800;
}
.toprest-suggestion-add {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 31px;
    margin-top: 5px !important;
    padding: 5px 8px !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
    text-align: center;
}
.toprest-group-suggestions__grid { grid-template-columns: 1fr; }

.toprest-rule-kpis {
    display: grid;
    grid-template-columns: repeat(4,minmax(0,1fr));
    gap: 10px;
    margin: 15px 0;
}
.toprest-rule-kpis > div {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 14px;
    border: 1px solid #dce8ed;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 3px 12px rgba(29,63,116,.04);
}
.toprest-rule-kpis b { color: #1d3f74; font-size: 25px; line-height: 1; }
.toprest-rule-kpis span { color: #607687; font-size: 12px; font-weight: 700; }
.toprest-rule-kpis .is-warning { border-color: #e8cd91; background: #fffaf0; }
.toprest-rule-kpis .is-warning b { color: #966100; }
.toprest-rule-kpis .is-good { border-color: #cce6d8; background: #f3fbf7; }
.toprest-rule-kpis .is-good b { color: #147a4f; }

.toprest-unconfigured-notice > details > ul {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(260px,1fr));
    gap: 9px;
    margin: 12px 0 2px;
    padding: 0;
}
.toprest-unconfigured-notice > details > ul > li {
    margin: 0;
    padding: 11px;
    border: 1px solid #ead49b;
    border-radius: 10px;
    background: #fffdf7;
    list-style: none;
}
.toprest-unconfigured-notice li > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}
.toprest-unconfigured-notice li > small { display: block; margin-top: 3px; color: #786b55; }
.toprest-unconfigured-notice li > p { margin: 7px 0 0; color: #5e5648; font-size: 12px; line-height: 1.7; }
.toprest-group-key {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin-top: 4px;
    padding: 3px 7px;
    overflow: hidden;
    border: 1px solid #cfe2e9;
    border-radius: 999px;
    background: #eff8fa;
    color: #276276;
    font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;
    font-size: 10px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.toprest-switch {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
    font-weight: 800;
}
.toprest-switch input { width: auto !important; min-width: 0 !important; margin: 0 !important; }
.toprest-group-rule-table td > small { display: block; margin-top: 4px; color: #687d8c; }
.toprest-group-rule-table td[data-label="المورد والمدينة"] strong,
.toprest-group-rule-table td[data-label="المورد والمدينة"] small,
.toprest-group-rule-table td[data-label="المورد والمدينة"] .toprest-group-key { display: block; }
.toprest-bulk-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
    gap: 10px;
    width: 100%;
}
.toprest-bulk-fields-grid label { display: block; font-weight: 800; }
.toprest-bulk-fields-grid input,
.toprest-bulk-fields-grid select { display: block; width: 100%; margin-top: 4px; }

@media (min-width: 480px) {
    .toprest-group-suggestions__grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (min-width: 900px) {
    .toprest-group-suggestions__grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 960px) {
    .toprest-rule-kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
    .toprest-rule-kpis { grid-template-columns: 1fr; }
    .toprest-cart-group__items > span { align-items: flex-start; flex-direction: column; border-radius: 10px; }
    .toprest-cart-group__items b { max-width: 100%; white-space: normal; }
    .toprest-remaining-options { align-items: stretch; flex-direction: column; }
    .toprest-remaining-options > span { justify-content: center; }
}

/* 6.4.0: compact cart planner and modal suggestions. */
.toprest-checkout-blocked-message { display: none !important; }
.toprest-cart-groups__heading {
    min-height: 36px;
    padding: 0 2px 5px;
}
.toprest-cart-groups__heading h2 {
    margin: 0;
    font-size: 17px;
}
.toprest-cart-groups__heading > strong {
    padding: 6px 10px;
}
.toprest-cart-groups.is-attention {
    animation: toprestPlannerAttention 1.2s ease;
}
@keyframes toprestPlannerAttention {
    0%,100% { box-shadow: none; }
    35% { box-shadow: 0 0 0 5px rgba(35,148,165,.18); }
}
.toprest-open-suggestions {
    width: 100%;
    min-height: 42px;
    margin-top: 12px !important;
    border-color: #2394a5 !important;
    border-radius: 11px !important;
    background: #1d3f74 !important;
    color: #fff !important;
    font-weight: 800 !important;
    text-align: center;
}
.toprest-open-suggestions:hover,
.toprest-open-suggestions:focus {
    background: #17345f !important;
    color: #fff !important;
}
body.toprest-suggestions-modal-open { overflow: hidden; }
.toprest-suggestions-modal[hidden] { display: none !important; }
.toprest-suggestions-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: 22px;
    direction: rtl;
}
.toprest-suggestions-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10,30,52,.58);
    backdrop-filter: blur(3px);
}
.toprest-suggestions-modal__dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto minmax(0,1fr) auto;
    width: min(980px,100%);
    max-height: min(86vh,780px);
    overflow: hidden;
    border: 1px solid #d8e7ec;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 28px 80px rgba(9,32,56,.28);
    color: #173a65;
    text-align: right;
}
.toprest-suggestions-modal__dialog > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 19px 14px;
    border-bottom: 1px solid #e1ebef;
    background: #f8fbfc;
}
.toprest-suggestions-modal__dialog > header span {
    display: block;
    color: #657c8c;
    font-size: 11px;
    font-weight: 800;
}
.toprest-suggestions-modal__dialog > header h2 {
    margin: 2px 0 3px;
    color: #1d3f74;
    font-size: 19px;
    line-height: 1.35;
}
.toprest-suggestions-modal__dialog > header p {
    margin: 0;
    color: #537080;
    font-size: 12px;
    font-weight: 700;
}
.toprest-suggestions-modal__close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #d5e3e8;
    border-radius: 50%;
    background: #fff;
    color: #506b7c;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}
.toprest-suggestions-modal__body {
    overflow: auto;
    padding: 16px 18px 20px;
    overscroll-behavior: contain;
}
.toprest-suggestions-modal__dialog > footer {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 18px;
    border-top: 1px solid #e1ebef;
    background: #fff;
}
.toprest-suggestions-modal__dialog > footer .button {
    min-height: 39px;
    border-radius: 10px;
}
.toprest-suggestions-modal__status {
    flex: 1 1 auto;
    color: #667d8d;
    font-size: 12px;
    font-weight: 700;
}
.toprest-suggestions-loading,
.toprest-suggestions-empty {
    min-height: 220px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 10px;
    color: #617887;
    text-align: center;
}
.toprest-suggestions-loading i {
    width: 32px;
    height: 32px;
    border: 3px solid #d7e7ec;
    border-top-color: #2394a5;
    border-radius: 50%;
    animation: toprestSuggestionSpin .75s linear infinite;
}
@keyframes toprestSuggestionSpin { to { transform: rotate(360deg); } }
.toprest-suggestions-empty strong { color: #1d3f74; font-size: 15px; }
.toprest-suggestions-empty span { font-size: 12px; }
.toprest-suggestion-modal-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 12px;
}
.toprest-suggestion-modal-card {
    display: grid;
    grid-template-columns: 88px minmax(0,1fr);
    gap: 11px;
    min-width: 0;
    padding: 10px;
    border: 1px solid #dce8ed;
    border-radius: 15px;
    background: #fff;
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.toprest-suggestion-modal-card:hover {
    border-color: #9bc5cf;
    transform: translateY(-1px);
}
.toprest-suggestion-modal-card.is-selected {
    border-color: #2394a5;
    box-shadow: 0 0 0 3px rgba(35,148,165,.11);
}
.toprest-suggestion-modal-card__image {
    display: grid;
    place-items: center;
    align-self: start;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 11px;
    background: #f5f9fa;
}
.toprest-suggestion-modal-card__image img {
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: contain;
}
.toprest-suggestion-modal-card__body {
    display: grid;
    align-content: start;
    gap: 7px;
    min-width: 0;
}
.toprest-suggestion-modal-card__body > a {
    color: #173a65;
    text-decoration: none;
}
.toprest-suggestion-modal-card__body strong {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.55;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.toprest-suggestion-modal-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
}
.toprest-suggestion-modal-card__meta span {
    color: #14806f;
    font-size: 12px;
    font-weight: 800;
}
.toprest-suggestion-modal-card__meta em {
    padding: 3px 7px;
    border-radius: 999px;
    background: #edf5f8;
    color: #526e7f;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
}
.toprest-use-recommended {
    width: 100%;
    padding: 5px 7px;
    border: 0;
    border-radius: 8px;
    background: #eef8fb;
    color: #1a7583;
    cursor: pointer;
    font-size: 10px;
    font-weight: 800;
}
.toprest-suggestion-qty {
    display: grid;
    grid-template-columns: 34px minmax(42px,1fr) 34px;
    align-items: center;
    overflow: hidden;
    border: 1px solid #cfdfe5;
    border-radius: 10px;
    background: #fff;
}
.toprest-suggestion-qty button {
    height: 34px;
    padding: 0;
    border: 0;
    background: #f3f8fa;
    color: #1d3f74;
    cursor: pointer;
    font-size: 19px;
    font-weight: 800;
}
.toprest-suggestion-qty input {
    width: 100% !important;
    min-width: 0;
    height: 34px;
    margin: 0 !important;
    padding: 0 3px !important;
    border: 0 !important;
    box-shadow: none !important;
    text-align: center;
    -moz-appearance: textfield;
}
.toprest-suggestion-qty input::-webkit-outer-spin-button,
.toprest-suggestion-qty input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.toprest-choose-product { width: 100%; text-align: center; }

@media (max-width: 900px) {
    .toprest-suggestion-modal-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
    .toprest-cart-groups { padding: 9px; }
    .toprest-cart-groups__heading { align-items: center; flex-direction: row; }
    .toprest-cart-groups__heading h2 { font-size: 15px; }
    .toprest-cart-groups__heading > strong { align-self: auto; width: auto; }
    .toprest-suggestions-modal { align-items: end; padding: 0; }
    .toprest-suggestions-modal__dialog {
        width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
    }
    .toprest-suggestions-modal__dialog > header { padding: 14px 15px 12px; }
    .toprest-suggestions-modal__dialog > header h2 { font-size: 17px; }
    .toprest-suggestions-modal__body { padding: 12px; }
    .toprest-suggestion-modal-grid { grid-template-columns: 1fr; gap: 9px; }
    .toprest-suggestion-modal-card { grid-template-columns: 76px minmax(0,1fr); }
    .toprest-suggestions-modal__dialog > footer {
        display: grid;
        grid-template-columns: 1fr 1.5fr;
        padding: 10px 12px max(10px,env(safe-area-inset-bottom));
    }
    .toprest-suggestions-modal__status { grid-column: 1 / -1; min-height: 18px; }
}

/* Order rules admin hotfix — 6.5.1 */
.toprest-group-rules-admin {
    width: calc(100% - 20px);
    max-width: 1600px;
    min-width: 0;
    overflow-x: clip;
}
.toprest-group-rules-admin > *,
.toprest-group-rules-admin .toprest-card,
.toprest-group-rules-admin form,
.toprest-group-rules-admin .toprest-group-rule-table-wrap {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}
.toprest-group-rules-admin .toprest-group-rule-table-wrap {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-gutter: stable;
}
.toprest-group-rules-admin .toprest-group-rule-table {
    width: 100%;
    min-width: 1240px;
    table-layout: fixed;
}
.toprest-group-rules-admin .toprest-group-rule-table th:nth-child(1) { width: 48px; }
.toprest-group-rules-admin .toprest-group-rule-table th:nth-child(2) { width: 168px; }
.toprest-group-rules-admin .toprest-group-rule-table th:nth-child(3) { width: 225px; }
.toprest-group-rules-admin .toprest-group-rule-table th:nth-child(4),
.toprest-group-rules-admin .toprest-group-rule-table th:nth-child(5) { width: 108px; }
.toprest-group-rules-admin .toprest-group-rule-table th:nth-child(6) { width: 135px; }
.toprest-group-rules-admin .toprest-group-rule-table th:nth-child(7) { width: 205px; }
.toprest-group-rules-admin .toprest-group-rule-table th:nth-child(8) { width: 125px; }
.toprest-group-rules-admin .toprest-group-rule-table th:nth-child(9) { width: 100px; }
.toprest-group-rules-admin .toprest-rule-filter-grid {
    grid-template-columns: minmax(220px,2fr) repeat(3,minmax(145px,1fr)) auto;
}
.toprest-selection-count {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff;
    color: #536b7b;
    font-size: 12px;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px #d7e5ea;
}
.toprest-bulk-bar .button:disabled {
    opacity: .55;
    cursor: not-allowed;
}
@media (max-width: 1250px) {
    .toprest-group-rules-admin .toprest-rule-filter-grid { grid-template-columns: repeat(2,minmax(180px,1fr)); }
    .toprest-group-rules-admin .toprest-filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
    .toprest-group-rules-admin { width: calc(100% - 12px); overflow-x: visible; }
    .toprest-group-rules-admin .toprest-group-rule-table { min-width: 0; table-layout: auto; }
}
@media (max-width: 782px) {
    .toprest-group-rules-admin { width: auto; margin-left: 10px; }
    .toprest-group-rules-admin .toprest-rule-filter-grid { grid-template-columns: 1fr; }
    .toprest-selection-count { justify-content: center; width: 100%; }
}

/* Cart experience and fulfilment planner — 6.6.0 */
.toprest-cart-experience {
    display: grid;
    gap: 14px;
    min-width: 0;
    margin: 18px 0 24px;
    direction: rtl;
}
.toprest-cart-experience .toprest-cart-groups { margin: 0; }
.toprest-cart-experience.is-attention {
    animation: toprestCartAttention .95s ease;
}
@keyframes toprestCartAttention {
    0%,100% { transform: translateY(0); }
    35% { transform: translateY(-4px); }
    70% { transform: translateY(2px); }
}

body.toprest-cart-enhanced.woocommerce-cart .wc-block-cart,
body.toprest-cart-enhanced .wp-block-woocommerce-cart {
    gap: clamp(18px,2.2vw,34px);
}
body.toprest-cart-enhanced .wc-block-cart__main,
body.toprest-cart-enhanced .wc-block-cart__sidebar {
    min-width: 0;
}
body.toprest-cart-enhanced .wp-block-woocommerce-cart-items-block,
body.toprest-cart-enhanced .woocommerce-cart-form {
    overflow: hidden;
    border: 1px solid #dbe7ec;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 35px rgba(27,61,98,.06);
}
body.toprest-cart-enhanced .wc-block-cart-items {
    margin: 0;
}
body.toprest-cart-enhanced .wc-block-cart-items__row {
    padding: clamp(14px,2vw,24px) !important;
    border-bottom: 1px solid #edf2f4 !important;
}
body.toprest-cart-enhanced .wc-block-cart-items__row:last-child {
    border-bottom: 0 !important;
}
body.toprest-cart-enhanced .wc-block-cart__sidebar .wp-block-woocommerce-cart-order-summary-block,
body.toprest-cart-enhanced .wc-block-cart__sidebar .wc-block-components-totals-wrapper,
body.toprest-cart-enhanced .cart-collaterals .cart_totals {
    border: 1px solid #dbe7ec;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 35px rgba(27,61,98,.06);
}
body.toprest-cart-enhanced .wc-block-cart__sidebar .wp-block-woocommerce-cart-order-summary-block,
body.toprest-cart-enhanced .cart-collaterals .cart_totals {
    position: sticky;
    top: 24px;
    overflow: hidden;
}
body.toprest-cart-enhanced .wc-block-cart__submit-button,
body.toprest-cart-enhanced .checkout-button {
    min-height: 54px;
    border-radius: 12px !important;
    font-weight: 800;
}

.toprest-cart-groups {
    border-color: #d5e5ea;
    background: linear-gradient(180deg,#fbfdfe 0%,#f6fafb 100%);
    box-shadow: 0 10px 30px rgba(27,61,98,.05);
}
.toprest-cart-group__items {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 10px;
}
.toprest-cart-group__items > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 9px;
    border: 1px solid #e0ebef;
    border-radius: 999px;
    background: #f8fbfc;
}
.toprest-cart-group__items b {
    max-width: 260px;
    overflow: hidden;
    color: #294d67;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.toprest-cart-group__items em {
    color: #168276;
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
    white-space: nowrap;
}
.toprest-open-suggestions {
    width: 100%;
    min-height: 43px;
    margin-top: 11px !important;
    border-color: #1f8fa0 !important;
    border-radius: 11px !important;
    background: #eef9fb !important;
    color: #176f7c !important;
    font-weight: 800 !important;
}
.toprest-remaining-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 9px;
}
.toprest-remaining-options strong { color: #5a6f7e; font-size: 11px; }
.toprest-remaining-options span {
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff3d7;
    color: #865a0c;
    font-size: 11px;
    font-weight: 800;
}

body.toprest-suggestions-modal-open { overflow: hidden; }
.toprest-suggestions-modal {
    z-index: 100050;
    will-change: opacity;
}
.toprest-suggestions-modal__dialog {
    width: min(980px,calc(100vw - 32px));
    max-height: min(820px,calc(100dvh - 32px));
}
.toprest-suggestions-modal__body {
    min-height: 280px;
}
.toprest-suggestions-modal__dialog > footer {
    flex-wrap: wrap;
}
.toprest-show-all-suggestions {
    margin-inline-start: auto !important;
    border-color: #b9d4dd !important;
    color: #1d6070 !important;
    text-decoration: none !important;
}
.toprest-suggestions-complete {
    min-height: 260px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 8px;
    text-align: center;
}
.toprest-suggestions-complete > span {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #e7f7ef;
    color: #168257;
    font-size: 30px;
    font-weight: 900;
}
.toprest-suggestions-complete strong { color: #174e39; font-size: 18px; }
.toprest-suggestions-complete p { margin: 0; color: #607687; }
.toprest-suggestion-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 18px;
}
.toprest-suggestion-card__badges span {
    padding: 2px 7px;
    border-radius: 999px;
    background: #eaf7f3;
    color: #18785b;
    font-size: 9px;
    font-weight: 900;
}

.toprest-delivery-preferences {
    overflow: hidden;
    border: 1px solid #d8e7ec;
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 9px 28px rgba(27,61,98,.05);
}
.toprest-delivery-preferences__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 17px;
}
.toprest-delivery-preferences__head span {
    display: inline-flex;
    margin-bottom: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef6f8;
    color: #577181;
    font-size: 10px;
    font-weight: 800;
}
.toprest-delivery-preferences__head h3 { margin: 0; color: #1d3f74; font-size: 16px; }
.toprest-delivery-preferences__head p { margin: 3px 0 0; color: #687d8c; font-size: 12px; line-height: 1.65; }
.toprest-delivery-toggle {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid #b9d7df;
    border-radius: 10px;
    background: #f4fbfc;
    color: #176f7c;
    cursor: pointer;
    font-weight: 800;
}
.toprest-delivery-preferences__body {
    padding: 15px 17px 17px;
    border-top: 1px solid #e5eef1;
    background: #fbfdfe;
}
.toprest-delivery-grid {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 12px;
}
.toprest-delivery-grid label { display: grid; gap: 6px; min-width: 0; }
.toprest-delivery-grid label > span { color: #3b586b; font-size: 12px; font-weight: 800; }
.toprest-delivery-grid input,
.toprest-delivery-grid select {
    width: 100%;
    min-height: 44px;
    margin: 0;
    border: 1px solid #cfdfe5;
    border-radius: 10px;
    background: #fff;
}
.toprest-delivery-save-state { min-height: 20px; margin-top: 8px; color: #5c7484; font-size: 11px; font-weight: 700; }

.toprest-completion-page,
.toprest-completion-empty {
    width: min(1220px,calc(100% - 28px));
    margin: 28px auto;
    color: #173a65;
}
.toprest-completion-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: clamp(18px,3vw,30px);
    border: 1px solid #d7e7ec;
    border-radius: 20px;
    background: linear-gradient(135deg,#f3fbfc,#fff);
    box-shadow: 0 12px 36px rgba(27,61,98,.06);
}
.toprest-completion-hero span { color: #218b9b; font-size: 12px; font-weight: 900; }
.toprest-completion-hero h1 { margin: 4px 0; color: #173a65; font-size: clamp(23px,4vw,34px); }
.toprest-completion-hero p { margin: 0; color: #607687; }
.toprest-completion-progress {
    margin: 15px 0;
    padding: 15px 18px;
    border: 1px solid #d7e7ec;
    border-radius: 16px;
    background: #fff;
}
.toprest-completion-progress > div:first-child { display: flex; justify-content: space-between; align-items: center; }
.toprest-completion-progress b { color: #168257; font-size: 24px; }
.toprest-completion-progress p { margin: 7px 0 0; color: #5e7483; font-size: 12px; font-weight: 700; }
.toprest-completion-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 15px;
    margin: 15px 0 10px;
}
.toprest-completion-toolbar label { display: grid; flex: 1 1 560px; gap: 5px; }
.toprest-completion-toolbar label span { color: #435f72; font-size: 12px; font-weight: 800; }
.toprest-completion-toolbar input { width: 100%; min-height: 44px; border-radius: 11px; }
.toprest-completion-toolbar > strong { color: #607687; font-size: 12px; }
.toprest-completion-page .toprest-suggestion-modal-grid.is-all-products {
    grid-template-columns: repeat(3,minmax(0,1fr));
}
.toprest-completion-actions {
    position: sticky;
    bottom: 12px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 12px;
    border: 1px solid #d2e3e8;
    border-radius: 14px;
    background: rgba(255,255,255,.96);
    box-shadow: 0 12px 38px rgba(20,51,77,.15);
    backdrop-filter: blur(10px);
}
.toprest-completion-status { flex: 1 1 auto; color: #587080; font-size: 12px; font-weight: 800; }
.toprest-completion-actions .button { min-height: 43px; border-radius: 10px; }
.toprest-completion-checkout.is-disabled,
.toprest-completion-checkout[aria-disabled="true"] { opacity: .5; pointer-events: auto; cursor: not-allowed; }
.toprest-completion-empty {
    padding: 40px 24px;
    border: 1px solid #d7e7ec;
    border-radius: 18px;
    background: #fff;
    text-align: center;
}

.toprest-order-delivery-customer {
    margin: 24px 0;
    padding: 18px;
    border: 1px solid #d8e7ec;
    border-radius: 14px;
}
.toprest-order-delivery-customer h2 { margin-top: 0; }
.toprest-order-delivery-customer dl { display: grid; gap: 8px; }
.toprest-order-delivery-customer dl > div { display: grid; grid-template-columns: 180px 1fr; gap: 10px; }
.toprest-order-delivery-customer dt { font-weight: 800; }
.toprest-order-delivery-customer dd { margin: 0; }

@media (max-width: 900px) {
    body.toprest-cart-enhanced .wc-block-cart__sidebar .wp-block-woocommerce-cart-order-summary-block,
    body.toprest-cart-enhanced .cart-collaterals .cart_totals { position: static; }
    .toprest-completion-page .toprest-suggestion-modal-grid.is-all-products { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 600px) {
    .toprest-cart-experience { margin: 12px 0 18px; }
    .toprest-cart-group__items b { max-width: 190px; }
    .toprest-delivery-preferences__head { align-items: stretch; flex-direction: column; }
    .toprest-delivery-toggle { width: 100%; }
    .toprest-delivery-grid { grid-template-columns: 1fr; }
    .toprest-suggestions-modal__dialog > footer { grid-template-columns: 1fr 1fr; }
    .toprest-show-all-suggestions { grid-column: 1 / -1; width: 100%; margin: 0 !important; text-align: center; }
    .toprest-completion-page,
    .toprest-completion-empty { width: min(100% - 18px,1220px); margin: 14px auto; }
    .toprest-completion-hero { align-items: stretch; flex-direction: column; }
    .toprest-completion-toolbar { align-items: stretch; flex-direction: column; }
    .toprest-completion-page .toprest-suggestion-modal-grid.is-all-products { grid-template-columns: 1fr; }
    .toprest-completion-actions { bottom: 6px; display: grid; grid-template-columns: 1fr 1fr; }
    .toprest-completion-status { grid-column: 1 / -1; }
    .toprest-order-delivery-customer dl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* Live projected completion — 6.6.0 */
.toprest-modal-live-progress {
    display: grid;
    gap: 7px;
    padding: 11px clamp(16px,2.2vw,24px);
    border-block: 1px solid #e2edf0;
    background: #f8fbfc;
}
.toprest-modal-live-progress > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.toprest-modal-live-progress span,
.toprest-modal-live-progress small {
    color: #5d7382;
    font-size: 11px;
    font-weight: 750;
}
.toprest-modal-live-progress b {
    color: #1d6f7c;
    font-size: 17px;
}
.toprest-suggestions-modal.is-projected-complete .toprest-modal-live-progress {
    background: #effaf4;
}
.toprest-suggestions-modal.is-projected-complete .toprest-modal-live-progress b,
.toprest-completion-page.is-projected-complete .toprest-completion-progress b {
    color: #168257;
}
.toprest-suggestions-modal.is-projected-complete [data-toprest-live-bar],
.toprest-completion-page.is-projected-complete [data-toprest-live-bar] {
    background: #1f9d68;
}

/* ========================================================================
 * TopRest visual system refresh — 6.7.0
 * Design-only layer: cart, completion flow, suggestions modal and admin UI.
 * ====================================================================== */
:root {
    --qa-v7-navy: #123a63;
    --qa-v7-navy-2: #0d2f52;
    --qa-v7-teal: #158b9d;
    --qa-v7-teal-dark: #0f6f7d;
    --qa-v7-mint: #eaf8f4;
    --qa-v7-sky: #eef8fb;
    --qa-v7-bg: #f6f9fb;
    --qa-v7-card: #ffffff;
    --qa-v7-text: #18344d;
    --qa-v7-muted: #6b7f8f;
    --qa-v7-line: #dce8ed;
    --qa-v7-line-strong: #c7dce3;
    --qa-v7-success: #168257;
    --qa-v7-warn: #a6670a;
    --qa-v7-danger: #b23c31;
    --qa-v7-shadow-sm: 0 6px 18px rgba(18,58,99,.055);
    --qa-v7-shadow: 0 18px 50px rgba(18,58,99,.10);
    --qa-v7-radius-sm: 12px;
    --qa-v7-radius: 18px;
    --qa-v7-radius-lg: 24px;
}

/* Accessible focus and controls. */
.toprest-cart-experience :is(button,a,input,select):focus-visible,
.toprest-suggestions-modal :is(button,a,input):focus-visible,
.toprest-completion-page :is(button,a,input,select):focus-visible {
    outline: 3px solid rgba(21,139,157,.24) !important;
    outline-offset: 2px;
}

/* Cart shell: cleaner whitespace, stronger product cards and summary. */
body.toprest-cart-enhanced.woocommerce-cart main,
body.toprest-cart-enhanced.woocommerce-cart .site-main,
body.toprest-cart-enhanced.woocommerce-cart .entry-content {
    min-width: 0;
}
body.toprest-cart-enhanced .wp-block-woocommerce-cart {
    max-width: 1480px;
    margin-inline: auto;
}
body.toprest-cart-enhanced .wp-block-woocommerce-cart-items-block,
body.toprest-cart-enhanced .woocommerce-cart-form {
    border-color: var(--qa-v7-line);
    border-radius: var(--qa-v7-radius-lg);
    box-shadow: var(--qa-v7-shadow-sm);
}
body.toprest-cart-enhanced .wc-block-cart-items__row {
    min-height: 150px;
    padding: clamp(18px,2.2vw,30px) !important;
    transition: background-color .18s ease, box-shadow .18s ease;
}
body.toprest-cart-enhanced .wc-block-cart-items__row:hover {
    background: #fbfdfe;
}
body.toprest-cart-enhanced .wc-block-cart-item__image img {
    border: 1px solid #e5eef1;
    border-radius: 16px;
    background: #fff;
    object-fit: contain;
}
body.toprest-cart-enhanced .wc-block-components-product-name {
    color: var(--qa-v7-navy);
    font-weight: 900;
    line-height: 1.55;
}
body.toprest-cart-enhanced .wc-block-components-product-metadata {
    color: var(--qa-v7-muted);
    font-size: 12px;
}
body.toprest-cart-enhanced .wc-block-components-quantity-selector {
    min-height: 44px;
    overflow: hidden;
    border: 1px solid var(--qa-v7-line-strong);
    border-radius: 12px;
    background: #fff;
}
body.toprest-cart-enhanced .wc-block-components-quantity-selector__button {
    min-width: 42px;
    color: var(--qa-v7-navy);
    background: #f4f9fb;
    font-size: 20px;
}
body.toprest-cart-enhanced .wc-block-cart-item__remove-link {
    color: var(--qa-v7-danger);
    font-size: 12px;
    font-weight: 800;
}
body.toprest-cart-enhanced .wc-block-cart__sidebar .wp-block-woocommerce-cart-order-summary-block,
body.toprest-cart-enhanced .cart-collaterals .cart_totals {
    overflow: hidden;
    border-color: var(--qa-v7-line);
    border-radius: var(--qa-v7-radius-lg);
    box-shadow: var(--qa-v7-shadow-sm);
}
body.toprest-cart-enhanced .wc-block-cart__sidebar .wc-block-cart__totals-title,
body.toprest-cart-enhanced .cart_totals h2 {
    margin: 0;
    padding: 20px 22px;
    border-bottom: 1px solid #edf2f4;
    color: var(--qa-v7-navy);
    font-size: 18px;
    font-weight: 900;
}
body.toprest-cart-enhanced .wc-block-cart__submit-button,
body.toprest-cart-enhanced .checkout-button {
    min-height: 56px;
    border: 0 !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg,var(--qa-v7-teal),var(--qa-v7-navy)) !important;
    box-shadow: 0 10px 22px rgba(18,58,99,.16);
    color: #fff !important;
    font-size: 15px;
    font-weight: 900;
    transition: transform .16s ease, box-shadow .16s ease;
}
body.toprest-cart-enhanced .wc-block-cart__submit-button:hover,
body.toprest-cart-enhanced .checkout-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(18,58,99,.22);
}

/* Fulfilment planner: compact, premium and easier to scan. */
.toprest-cart-experience {
    gap: 16px;
    margin: 20px 0 28px;
}
.toprest-cart-groups {
    gap: 12px;
    padding: clamp(14px,2vw,20px);
    border-color: var(--qa-v7-line);
    border-radius: var(--qa-v7-radius-lg);
    background:
        radial-gradient(circle at 100% 0,rgba(21,139,157,.08),transparent 34%),
        linear-gradient(180deg,#fff,#f8fbfc);
    box-shadow: var(--qa-v7-shadow-sm);
}
.toprest-cart-groups__heading {
    min-height: auto;
    padding: 0 2px 8px;
}
.toprest-cart-groups__heading span {
    color: var(--qa-v7-teal-dark);
    letter-spacing: .2px;
}
.toprest-cart-groups__heading h2 {
    color: var(--qa-v7-navy);
    font-size: clamp(17px,2vw,21px);
    font-weight: 900;
}
.toprest-cart-groups__heading > strong {
    padding: 7px 12px;
    border: 1px solid #d7ece4;
    background: var(--qa-v7-mint);
    color: var(--qa-v7-success);
}
.toprest-cart-group {
    padding: clamp(14px,2vw,18px);
    border-color: var(--qa-v7-line);
    border-radius: var(--qa-v7-radius);
    box-shadow: none;
}
.toprest-cart-group.is-incomplete {
    border-color: #edd7ac;
    background: linear-gradient(180deg,#fffefb,#fffaf1);
}
.toprest-cart-group.is-complete {
    border-color: #cfe8dc;
    background: linear-gradient(180deg,#fff,#f8fdf9);
}
.toprest-cart-group__top h3 {
    color: var(--qa-v7-navy);
    font-size: 16px;
    font-weight: 900;
}
.toprest-cart-group__state {
    padding: 5px 9px;
    border: 1px solid #f0d9aa;
    background: #fff7e8;
}
.toprest-cart-group.is-complete .toprest-cart-group__state {
    border-color: #d5eadf;
    background: var(--qa-v7-mint);
}
.toprest-cart-group__count b {
    color: var(--qa-v7-navy);
    font-size: 26px;
}
.toprest-cart-group__progress {
    height: 9px;
    margin: 14px 0;
    background: #eaf0f2;
}
.toprest-cart-group__progress i {
    background: linear-gradient(90deg,#d9992b,#efb343);
}
.toprest-cart-group.is-complete .toprest-cart-group__progress i {
    background: linear-gradient(90deg,#1c9b68,#43b883);
}
.toprest-cart-group__message {
    border: 1px solid #f0dfbd;
    border-radius: 13px;
    background: #fff8eb;
}
.toprest-cart-group__message.is-success {
    border-color: #d5eadf;
    background: var(--qa-v7-mint);
}
.toprest-cart-group__items > span {
    border-color: #dfeaed;
    background: #fff;
}
.toprest-open-suggestions {
    min-height: 47px;
    border: 0 !important;
    border-radius: 13px !important;
    background: linear-gradient(135deg,var(--qa-v7-teal),var(--qa-v7-navy)) !important;
    box-shadow: 0 8px 18px rgba(18,58,99,.12);
    transition: transform .16s ease, box-shadow .16s ease;
}
.toprest-open-suggestions:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(18,58,99,.18);
}

/* Delivery preferences as a calm optional card. */
.toprest-delivery-preferences {
    border-color: var(--qa-v7-line);
    border-radius: var(--qa-v7-radius-lg);
    box-shadow: var(--qa-v7-shadow-sm);
}
.toprest-delivery-preferences__head {
    padding: 18px 20px;
    background: linear-gradient(180deg,#fff,#fbfdfe);
}
.toprest-delivery-preferences__head h3 {
    color: var(--qa-v7-navy);
    font-size: 17px;
    font-weight: 900;
}
.toprest-delivery-toggle {
    min-height: 42px;
    border-color: #bdd9e0;
    border-radius: 12px;
    background: var(--qa-v7-sky);
    color: var(--qa-v7-teal-dark);
}
.toprest-delivery-preferences__body {
    padding: 18px 20px 20px;
}
.toprest-delivery-grid input,
.toprest-delivery-grid select {
    min-height: 46px;
    border-color: var(--qa-v7-line-strong);
    border-radius: 12px;
}

/* Stable premium modal: sticky header/progress/footer and clearer products. */
.toprest-suggestions-modal__backdrop {
    background: rgba(8,27,47,.68);
    backdrop-filter: blur(6px);
}
.toprest-suggestions-modal__dialog {
    width: min(1080px,calc(100vw - 36px));
    max-height: min(880px,calc(100dvh - 36px));
    border-color: rgba(255,255,255,.35);
    border-radius: 26px;
    box-shadow: 0 34px 100px rgba(7,27,48,.38);
}
.toprest-suggestions-modal__dialog > header {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 20px 22px 17px;
    border-bottom-color: var(--qa-v7-line);
    background:
        radial-gradient(circle at 100% 0,rgba(21,139,157,.12),transparent 42%),
        #fff;
}
.toprest-suggestions-modal__dialog > header span {
    color: var(--qa-v7-teal-dark);
}
.toprest-suggestions-modal__dialog > header h2 {
    color: var(--qa-v7-navy);
    font-size: clamp(19px,2.2vw,24px);
    font-weight: 950;
}
.toprest-suggestions-modal__close {
    width: 40px;
    height: 40px;
    border-color: var(--qa-v7-line);
    color: var(--qa-v7-navy);
    transition: transform .16s ease, background .16s ease;
}
.toprest-suggestions-modal__close:hover {
    transform: rotate(4deg);
    background: #f3f8fa;
}
.toprest-modal-live-progress {
    position: sticky;
    top: 89px;
    z-index: 2;
    padding: 12px 22px;
    background: rgba(248,251,252,.96);
    backdrop-filter: blur(10px);
}
.toprest-modal-live-progress b {
    color: var(--qa-v7-teal-dark);
    font-size: 19px;
}
.toprest-suggestions-modal__body {
    padding: 18px 20px 24px;
    background: #f7fafb;
}
.toprest-suggestion-modal-grid {
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 14px;
}
.toprest-suggestion-modal-card {
    grid-template-columns: 104px minmax(0,1fr);
    gap: 13px;
    padding: 12px;
    border-color: var(--qa-v7-line);
    border-radius: 18px;
    box-shadow: 0 5px 16px rgba(18,58,99,.035);
}
.toprest-suggestion-modal-card:hover {
    border-color: #91c2cb;
    box-shadow: 0 12px 28px rgba(18,58,99,.09);
    transform: translateY(-2px);
}
.toprest-suggestion-modal-card.is-selected {
    border-color: var(--qa-v7-teal);
    background: #fbfeff;
    box-shadow: 0 0 0 3px rgba(21,139,157,.12),0 12px 28px rgba(18,58,99,.08);
}
.toprest-suggestion-modal-card__image {
    border: 1px solid #e8eff2;
    border-radius: 14px;
    background: #fff;
}
.toprest-suggestion-modal-card__body strong {
    color: var(--qa-v7-navy);
    font-size: 13px;
    font-weight: 900;
}
.toprest-use-recommended {
    min-height: 30px;
    border: 1px solid #d7e9ee;
    border-radius: 9px;
    background: var(--qa-v7-sky);
}
.toprest-suggestion-qty {
    min-height: 40px;
    border-color: var(--qa-v7-line-strong);
    border-radius: 11px;
}
.toprest-suggestion-qty button {
    height: 40px;
    background: #f1f7f9;
}
.toprest-suggestion-qty input { height: 40px; font-weight: 900; }
.toprest-suggestions-modal__dialog > footer {
    position: sticky;
    bottom: 0;
    z-index: 4;
    padding: 14px 20px;
    border-top-color: var(--qa-v7-line);
    background: rgba(255,255,255,.97);
    box-shadow: 0 -8px 24px rgba(18,58,99,.06);
    backdrop-filter: blur(12px);
}
.toprest-suggestions-modal__dialog > footer .button-primary {
    min-height: 46px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg,var(--qa-v7-teal),var(--qa-v7-navy));
    box-shadow: 0 8px 18px rgba(18,58,99,.14);
}
.toprest-show-all-suggestions {
    min-height: 44px !important;
    border-radius: 12px !important;
    background: #f8fbfc !important;
}

/* Completion page: more like a focused storefront, not an admin table. */
.toprest-completion-page,
.toprest-completion-empty {
    width: min(1320px,calc(100% - 32px));
    margin: 30px auto;
}
.toprest-completion-hero {
    padding: clamp(22px,3vw,36px);
    border-color: var(--qa-v7-line);
    border-radius: 26px;
    background:
        radial-gradient(circle at 100% 0,rgba(21,139,157,.13),transparent 38%),
        linear-gradient(135deg,#f5fcfd,#fff 58%);
    box-shadow: var(--qa-v7-shadow);
}
.toprest-completion-hero h1 {
    color: var(--qa-v7-navy);
    font-weight: 950;
}
.toprest-completion-progress {
    padding: 18px 20px;
    border-color: var(--qa-v7-line);
    border-radius: 18px;
    box-shadow: var(--qa-v7-shadow-sm);
}
.toprest-completion-toolbar {
    padding: 14px;
    border: 1px solid var(--qa-v7-line);
    border-radius: 16px;
    background: #fff;
}
.toprest-completion-toolbar input {
    min-height: 47px;
    border-color: var(--qa-v7-line-strong);
    border-radius: 12px;
}
.toprest-completion-page .toprest-suggestion-modal-grid.is-all-products {
    grid-template-columns: repeat(3,minmax(0,1fr));
    margin-top: 14px;
}
.toprest-completion-actions {
    bottom: 14px;
    padding: 14px;
    border-color: var(--qa-v7-line);
    border-radius: 17px;
    box-shadow: 0 18px 42px rgba(18,58,99,.16);
}
.toprest-completion-actions .button-primary,
.toprest-completion-checkout {
    border: 0 !important;
    background: linear-gradient(135deg,var(--qa-v7-teal),var(--qa-v7-navy)) !important;
    color: #fff !important;
}

/* Admin pages: unified visual hierarchy and desktop width containment. */
.toprest-admin.toprest-offers-admin,
.toprest-admin.toprest-group-rules-admin,
.toprest-admin:not(.toprest-sources-page) {
    max-width: 1600px;
    min-width: 0;
    margin-top: 20px;
}
.toprest-admin.toprest-offers-admin > h1,
.toprest-admin.toprest-group-rules-admin > h1,
.toprest-admin:not(.toprest-sources-page) > h1 {
    margin: 0 0 8px;
    color: var(--qa-v7-navy);
    font-size: clamp(23px,2.2vw,31px);
    font-weight: 950;
    line-height: 1.35;
}
.toprest-admin.toprest-offers-admin > h1::before,
.toprest-admin.toprest-group-rules-admin > h1::before {
    content: "توب رست";
    display: inline-flex;
    margin-left: 9px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e8f7f8;
    color: var(--qa-v7-teal-dark);
    font-size: 11px;
    font-weight: 900;
    vertical-align: middle;
}
.toprest-admin .toprest-card,
.toprest-admin .toprest-offer-list-card,
.toprest-admin .toprest-bulk-builder {
    border-color: var(--qa-v7-line);
    border-radius: 18px;
    box-shadow: var(--qa-v7-shadow-sm);
}
.toprest-admin .toprest-section-heading {
    padding-bottom: 4px;
}
.toprest-admin .toprest-section-heading h2 {
    color: var(--qa-v7-navy);
    font-weight: 900;
}
.toprest-rule-filter-grid,
.toprest-offer-filter-grid,
.toprest-bulk-bar,
.toprest-rule-tools {
    border-color: var(--qa-v7-line);
    border-radius: 14px;
    background: #f8fbfc;
}
.toprest-admin :is(input[type="text"],input[type="number"],input[type="search"],select,textarea) {
    border-color: var(--qa-v7-line-strong);
    border-radius: 10px;
}
.toprest-admin :is(input,select,textarea):focus {
    border-color: var(--qa-v7-teal);
    box-shadow: 0 0 0 1px var(--qa-v7-teal);
}
.toprest-admin .button-primary {
    border-color: var(--qa-v7-teal-dark);
    border-radius: 10px;
    background: var(--qa-v7-teal-dark);
}
.toprest-admin .toprest-table,
.toprest-admin .toprest-group-rule-table {
    overflow: hidden;
    border: 1px solid var(--qa-v7-line);
    border-radius: 14px;
    background: #fff;
}
.toprest-admin .toprest-table thead th,
.toprest-admin .toprest-group-rule-table thead th {
    background: #eef6f8;
    color: var(--qa-v7-navy);
    font-weight: 900;
}
.toprest-admin .toprest-table tbody tr:hover td,
.toprest-admin .toprest-group-rule-table tbody tr:hover td {
    background: #fbfdfe;
}

@media (max-width: 1100px) {
    .toprest-suggestion-modal-grid,
    .toprest-completion-page .toprest-suggestion-modal-grid.is-all-products {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}
@media (max-width: 782px) {
    body.toprest-cart-enhanced .wc-block-cart-items__row { min-height: auto; padding: 16px !important; }
    .toprest-cart-groups { padding: 11px; border-radius: 18px; }
    .toprest-cart-groups__heading { align-items: flex-start; flex-direction: column; }
    .toprest-cart-groups__heading > strong { width: 100%; text-align: center; }
    .toprest-cart-group__top { align-items: flex-start; }
    .toprest-suggestions-modal { align-items: end; padding: 0; }
    .toprest-suggestions-modal__dialog {
        width: 100%;
        max-height: 94dvh;
        border-radius: 24px 24px 0 0;
    }
    .toprest-suggestions-modal__dialog > header { padding: 16px 16px 13px; }
    .toprest-modal-live-progress { top: 82px; padding-inline: 16px; }
    .toprest-suggestions-modal__body { padding: 12px; }
    .toprest-suggestion-modal-grid,
    .toprest-completion-page .toprest-suggestion-modal-grid.is-all-products {
        grid-template-columns: 1fr;
    }
    .toprest-suggestion-modal-card { grid-template-columns: 88px minmax(0,1fr); padding: 10px; }
    .toprest-suggestions-modal__dialog > footer { padding: 11px 12px max(11px,env(safe-area-inset-bottom)); }
    .toprest-completion-page,
    .toprest-completion-empty { width: min(100% - 16px,1320px); margin: 14px auto; }
    .toprest-completion-hero { border-radius: 20px; }
    .toprest-completion-toolbar { align-items: stretch; flex-direction: column; }
    .toprest-completion-actions { bottom: 6px; }
}
@media (max-width: 480px) {
    .toprest-cart-group__count b { font-size: 22px; }
    .toprest-suggestion-modal-card { grid-template-columns: 78px minmax(0,1fr); }
    .toprest-suggestions-modal__dialog > footer { grid-template-columns: 1fr; }
    .toprest-suggestions-modal__status,
    .toprest-show-all-suggestions { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
    .toprest-cart-experience *,
    .toprest-suggestions-modal *,
    .toprest-completion-page * {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ======================================================================
 * Stable cart composition — 6.8.0
 * TopRest Locations owns the dynamic fulfilment panels and the cart shell.
 * The active theme must not add another cart grid.
 * ====================================================================== */
body.woocommerce-cart.toprest-cart-enhanced {
    --qa-cart-max: 1280px;
    --qa-cart-summary: 360px;
    --qa-cart-gap: 24px;
    --qa-cart-radius: 18px;
    --qa-cart-item-pad: 20px;
    --qa-cart-image: 88px;
    --qa-cart-summary-position: sticky;
    --qa-cart-primary: #123a63;
    --qa-cart-accent: #158b9d;
    --qa-cart-border: #dce8ed;
    --qa-cart-page-bg: #ffffff;
}
body.woocommerce-cart.toprest-cart-enhanced :is(.site-main,.entry-content,.wp-block-post-content) {
    min-width: 0 !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart {
    display: block !important;
    width: min(100%,var(--qa-cart-max)) !important;
    max-width: var(--qa-cart-max) !important;
    margin-inline: auto !important;
    padding-inline: clamp(10px,2vw,22px) !important;
    box-sizing: border-box !important;
    background: var(--qa-cart-page-bg);
}
body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart .wc-block-components-sidebar-layout.wc-block-cart,
body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart .wc-block-cart.wc-block-components-sidebar-layout {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) minmax(300px,var(--qa-cart-summary)) !important;
    grid-template-areas: "products summary" !important;
    gap: var(--qa-cart-gap) !important;
    align-items: start !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    direction: rtl !important;
    box-sizing: border-box !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart__main,
body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart-items-block {
    grid-area: products !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    float: none !important;
    box-sizing: border-box !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart__sidebar,
body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart-totals-block {
    grid-area: summary !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    float: none !important;
    align-self: start !important;
    position: var(--qa-cart-summary-position) !important;
    top: 24px;
    box-sizing: border-box !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart-items-block,
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart__sidebar .wp-block-woocommerce-cart-order-summary-block,
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart__sidebar .wc-block-components-totals-wrapper,
body.woocommerce-cart.toprest-cart-enhanced .woocommerce-cart-form,
body.woocommerce-cart.toprest-cart-enhanced .cart-collaterals .cart_totals {
    overflow: hidden !important;
    border: 1px solid var(--qa-cart-border) !important;
    border-radius: var(--qa-cart-radius) !important;
    background: #fff !important;
    box-shadow: 0 12px 32px rgba(18,58,99,.07) !important;
    box-sizing: border-box !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart-items {
    width: 100% !important;
    margin: 0 !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart-items__row {
    min-height: 0 !important;
    padding: var(--qa-cart-item-pad) !important;
    border-bottom: 1px solid #edf3f5 !important;
    background: #fff !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart-items__row:last-child {
    border-bottom: 0 !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart-item__image {
    width: calc(var(--qa-cart-image) + 16px) !important;
    padding-inline: 0 16px !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart-item__image img,
body.woocommerce-cart.toprest-cart-enhanced .wc-block-components-product-image img {
    width: var(--qa-cart-image) !important;
    height: var(--qa-cart-image) !important;
    max-width: var(--qa-cart-image) !important;
    object-fit: contain !important;
    border: 1px solid #e5eef1 !important;
    border-radius: calc(var(--qa-cart-radius) - 5px) !important;
    background: #fff !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-components-product-name {
    color: var(--qa-cart-primary) !important;
    font-size: clamp(15px,1.45vw,18px) !important;
    font-weight: 900 !important;
    line-height: 1.55 !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart__sidebar .wc-block-cart__totals-title,
body.woocommerce-cart.toprest-cart-enhanced .cart_totals h2 {
    color: var(--qa-cart-primary) !important;
}
body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart__submit-button,
body.woocommerce-cart.toprest-cart-enhanced .checkout-button,
body.woocommerce-cart.toprest-cart-enhanced .toprest-open-suggestions {
    border: 0 !important;
    background: linear-gradient(135deg,var(--qa-cart-accent),var(--qa-cart-primary)) !important;
    color: #fff !important;
}

/* The dynamic experience is a full-width sibling after the two-column layout. */
body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart > .toprest-cart-experience,
body.woocommerce-cart.toprest-cart-enhanced .toprest-cart-experience[data-toprest-mounted="1"] {
    display: grid !important;
    grid-template-columns: minmax(0,2fr) minmax(280px,1fr) !important;
    grid-template-areas: "rules delivery" !important;
    gap: var(--qa-cart-gap) !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: var(--qa-cart-gap) 0 0 !important;
    padding: 0 !important;
    clear: both !important;
    direction: rtl !important;
    box-sizing: border-box !important;
}
body.woocommerce-cart.toprest-cart-enhanced .toprest-cart-experience > .toprest-cart-groups {
    grid-area: rules !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
}
body.woocommerce-cart.toprest-cart-enhanced .toprest-cart-experience > .toprest-delivery-preferences {
    grid-area: delivery !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    align-self: start !important;
}
body.woocommerce-cart.toprest-cart-enhanced .toprest-cart-experience > :only-child {
    grid-column: 1 / -1 !important;
}

@media (max-width: 1023px) {
    body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart > .wc-block-components-sidebar-layout,
    body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart > .wc-block-cart.wc-block-components-sidebar-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 18px !important;
    }
    body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart__main,
    body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart-items-block { order: 1 !important; }
    body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart__sidebar,
    body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart-totals-block {
        order: 2 !important;
        position: static !important;
    }
    body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart > .toprest-cart-experience,
    body.woocommerce-cart.toprest-cart-enhanced .toprest-cart-experience[data-toprest-mounted="1"] {
        grid-template-columns: 1fr !important;
        grid-template-areas: "rules" "delivery" !important;
    }
}
@media (max-width: 689px) {
    body.woocommerce-cart.toprest-cart-enhanced .wp-block-woocommerce-cart {
        padding-inline: 8px !important;
    }
    body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart-items__row {
        padding: 13px !important;
    }
    body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart-item__image {
        width: 78px !important;
        padding-inline: 0 10px !important;
    }
    body.woocommerce-cart.toprest-cart-enhanced .wc-block-cart-item__image img,
    body.woocommerce-cart.toprest-cart-enhanced .wc-block-components-product-image img {
        width: 68px !important;
        height: 68px !important;
        max-width: 68px !important;
    }
    body.woocommerce-cart.toprest-cart-enhanced .toprest-cart-groups,
    body.woocommerce-cart.toprest-cart-enhanced .toprest-delivery-preferences {
        border-radius: 16px !important;
    }
}
