/* Full-width stock manager: hide theme blog sidebar if template did not apply */
body.resha-stock-manager-page #secondary,
body.resha-stock-manager-page .wd-sidebar,
body.resha-stock-manager-page .sidebar-container,
body.resha-stock-manager-page aside.sidebar {
    display: none !important;
}

body.resha-stock-manager-page .wd-content-area {
    flex: 1 1 100% !important;
    max-width: 100% !important;
}

.resha-stock-app {
    max-width: 100%;
    margin: 24px auto;
    padding: 0 16px 24px;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    color: #111827;
}

/* Main grid: list left, product info right */
.resha-stock-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
    gap: 20px;
    align-items: start;
}

.resha-stock-main {
    min-width: 0;
}

.resha-product-info {
    position: sticky;
    top: 24px;
    align-self: start;
}

.resha-product-info-inner {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

.resha-product-info-heading {
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.resha-product-info-placeholder {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

.resha-product-info-content {
    font-size: 13px;
    line-height: 1.45;
    color: #334155;
}

.resha-info-loading,
.resha-info-error {
    margin: 0;
    color: #64748b;
}

.resha-info-error {
    color: #b91c1c;
}

.resha-detail-card {
    margin-bottom: 12px;
}

.resha-detail-image {
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    margin-bottom: 10px;
}

.resha-detail-image img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

.resha-detail-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.resha-detail-price {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.resha-detail-price .woocommerce-Price-amount {
    font-weight: 700;
}

.resha-detail-sku,
.resha-detail-cats {
    margin: 0 0 8px;
    font-size: 12px;
}

/* Sidebar: full-width stacked actions (anchors need explicit flex + theme resets) */
.resha-detail-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.resha-product-info-content .resha-detail-actions .resha-detail-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none !important;
    box-sizing: border-box;
    border-radius: 10px;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.resha-product-info-content .resha-detail-actions .resha-detail-action:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.resha-product-info-content .resha-detail-actions a.resha-btn-primary {
    background: #0f172a;
    border: 1px solid #0f172a;
    color: #fff !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.resha-product-info-content .resha-detail-actions a.resha-btn-primary:hover {
    background: #1e293b;
    border-color: #1e293b;
    color: #fff !important;
}

.resha-product-info-content .resha-detail-actions a.resha-btn-secondary {
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #0f172a !important;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.resha-product-info-content .resha-detail-actions a.resha-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a !important;
}

.resha-detail-actions .resha-external-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 12px;
    opacity: 0.75;
    font-weight: 700;
}

.resha-detail-variant {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.resha-detail-variant-title {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
}

.resha-detail-variant-label {
    margin: 0 0 8px;
    font-weight: 600;
    color: #1e293b;
}

.resha-detail-variant-price {
    margin: 6px 0 8px;
    font-weight: 700;
}

.resha-detail-simple p {
    margin: 0 0 6px;
}

.resha-variant-row.is-selected {
    background: #eff6ff;
    box-shadow: inset 3px 0 0 #2563eb;
}

@media (max-width: 1100px) {
    .resha-stock-layout {
        grid-template-columns: 1fr;
    }

    .resha-product-info {
        position: static;
    }
}

.resha-stock-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: linear-gradient(120deg, #0f172a, #1f2937);
    color: #fff;
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 16px;
}

.resha-stock-hero h1 {
    margin: 0 0 6px;
    color: #fff;
    font-size: 28px;
    line-height: 1.1;
}

.resha-stock-hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.88);
}

/* Side-by-side collapsible panels (filters + bulk) */
.resha-controls-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
    align-items: start;
}

.resha-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.resha-panel-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: none;
    background: #f8fafc;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: #111827;
    transition: background 0.15s ease;
}

.resha-panel-toggle:hover {
    background: #f1f5f9;
}

.resha-panel-toggle-label {
    font-weight: 700;
    font-size: 14px;
}

.resha-panel-toggle-hint {
    flex: 1;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.resha-panel-chevron {
    font-size: 10px;
    color: #64748b;
    transition: transform 0.2s ease;
}

.resha-panel.is-open .resha-panel-chevron {
    transform: rotate(180deg);
}

.resha-panel-body {
    padding: 14px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.resha-stock-filters-inner {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.resha-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.resha-field label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.resha-field input,
.resha-field select,
.resha-bulk select {
    height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    color: #111827;
}

.resha-field input:focus,
.resha-field select:focus,
.resha-bulk select:focus {
    border-color: #111827;
    box-shadow: 0 0 0 1px #111827;
    outline: none;
}

.resha-field-search {
    grid-column: span 2;
}

.resha-filter-actions {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
}

.resha-bulk-inner {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.resha-bulk {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.resha-bulk select {
    min-width: 180px;
}

.resha-meta {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: #6b7280;
}

.resha-btn {
    height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #111827;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.resha-btn:hover {
    background: #f9fafb;
}

.resha-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.resha-btn-primary {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.resha-btn-primary:hover {
    background: #1f2937;
}

.resha-btn-secondary {
    background: #fff;
    border-color: #cbd5e1;
    color: #0f172a;
}

.resha-btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.resha-stock-notice {
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 13px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
}

.resha-stock-notice.success {
    border-color: #86efac;
    background: #f0fdf4;
    color: #166534;
}

.resha-stock-notice.error {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #991b1b;
}

/* Grouped products */
.resha-stock-table-wrap {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.resha-table-global-actions {
    padding: 10px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
}

.resha-global-actions-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
}

.resha-expand-actions {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.resha-expand-actions .resha-btn {
    font-size: 12px;
    height: 34px;
    padding: 0 12px;
}

.resha-select-all-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
}

.resha-select-all-wrap input {
    width: 16px;
    height: 16px;
}

.resha-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.resha-page-info {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.resha-grouped-list {
    padding: 8px 8px 12px;
    max-height: none;
}

.resha-product-block {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 8px;
    background: #fff;
    overflow: hidden;
}

.resha-product-block:last-child {
    margin-bottom: 0;
}

.resha-product-head-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 16px;
    padding: 10px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e8ecf0;
}

.resha-product-head-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
    flex: 0 1 auto;
    min-width: 0;
}

.resha-product-head-toggle:hover {
    background: rgba(15, 23, 42, 0.04);
}

.resha-product-head-badges {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}

.resha-product-head-tools {
    flex: 1 1 260px;
    min-width: min(100%, 240px);
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
}

.resha-product-chevron {
    display: inline-block;
    font-size: 12px;
    color: #64748b;
    transition: transform 0.2s ease;
    width: 1.25em;
    flex-shrink: 0;
}

.resha-product-block:not(.is-collapsed) .resha-product-chevron {
    transform: rotate(90deg);
}

.resha-product-title {
    font-weight: 700;
    font-size: 15px;
    color: #0f172a;
    min-width: 0;
}

.resha-product-meta {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
}

.resha-product-total {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    background: #e2e8f0;
    padding: 4px 10px;
    border-radius: 999px;
}

.resha-product-variants {
    padding: 0 12px 14px;
    background: #fff;
}

.resha-product-toolbar {
    padding: 12px 4px 14px;
    margin: 0 0 10px;
    border-bottom: 1px solid #e2e8f0;
}

.resha-product-toolbar--inline {
    padding: 0;
    margin: 0;
    border: none;
    width: 100%;
    max-width: 100%;
}

.resha-product-head-tools .resha-toolbar-single-row {
    justify-content: flex-end;
}

.resha-product-head-tools .resha-add-variant {
    margin-left: 0;
}

.resha-toolbar-single-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 16px;
    width: 100%;
}

.resha-toolbar-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.resha-toolbar-field--categories {
    flex: 1 1 200px;
    min-width: min(100%, 220px);
}

.resha-toolbar-field--psft {
    flex: 0 0 auto;
}

.resha-toolbar-field-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.resha-toolbar-inline-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 4px;
    display: block;
}

.resha-toolbar-field--psft .resha-default-psft {
    width: 132px;
}

.resha-toolbar-single-row > .resha-add-variant {
    flex: 0 0 auto;
    margin-left: auto;
}

@media (max-width: 640px) {
    .resha-toolbar-single-row > .resha-add-variant {
        margin-left: 0;
    }
}

/* Slim category multiselect (custom dropdown) */
.resha-cat-multiselect {
    position: relative;
    width: 100%;
    min-width: 0;
}

.resha-cat-multiselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: #0f172a;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.resha-cat-multiselect-trigger:hover {
    border-color: #94a3b8;
}

.resha-cat-multiselect-trigger:focus-visible {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.resha-cat-multiselect-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.resha-cat-multiselect-chevron {
    flex-shrink: 0;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #64748b;
    margin-top: 2px;
}

.resha-cat-multiselect-panel {
    position: absolute;
    z-index: 80;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: min(260px, 50vh);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    box-sizing: border-box;
}

.resha-cat-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    margin: 0;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.35;
    color: #1e293b;
    cursor: pointer;
}

.resha-cat-option:hover {
    background: #f1f5f9;
}

.resha-cat-option input {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: #0f172a;
}

.resha-cat-option-text {
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

.resha-default-psft {
    width: 140px;
    max-width: 100%;
    height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 14px;
    box-sizing: border-box;
}

.resha-variant-row.resha-row-pending {
    opacity: 0.72;
}

.resha-psft-cell {
    min-width: 104px;
}

.resha-psft-cell input {
    width: 100%;
    min-width: 96px;
    max-width: 120px;
    height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 8px;
    font-size: 13px;
    box-sizing: border-box;
}

.resha-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.resha-modal[hidden] {
    display: none !important;
}

.resha-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.45);
    cursor: pointer;
}

.resha-modal-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
    border: 1px solid #e2e8f0;
}

.resha-modal-box h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #0f172a;
}

.resha-modal-hint {
    margin: 0 0 16px;
    font-size: 13px;
    color: #64748b;
    line-height: 1.45;
}

.resha-modal-fields .resha-modal-row {
    margin-bottom: 12px;
}

.resha-modal-attr .resha-var-attr-custom {
    margin-top: 8px;
    width: 100%;
    height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 13px;
    box-sizing: border-box;
}

.resha-modal-attr .resha-var-attr {
    width: 100%;
    min-height: 40px;
}

.resha-modal-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.resha-modal-row label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
}

.resha-modal-row select,
.resha-modal-row input[type="number"],
.resha-modal-row input[type="text"] {
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 10px;
    font-size: 14px;
}

.resha-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
}

.resha-stock-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.resha-product-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 4px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.resha-stock-table--nested {
    margin-top: 0;
}

.resha-stock-table th,
.resha-stock-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf0f3;
    text-align: left;
    vertical-align: middle;
}

.resha-stock-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    font-weight: 700;
    background: #f8fafc;
}

.resha-col-check {
    width: 40px;
}

.resha-col-manage {
    width: 56px;
    text-align: center;
}

.resha-stock-manage-cell {
    text-align: center;
    vertical-align: middle;
}

.resha-stock-manage-cell .resha-manage-stock {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0f172a;
}

.resha-stock-variant {
    color: #1f2937;
    font-size: 13px;
    font-weight: 500;
}

.resha-sku {
    color: #6b7280;
    font-size: 12px;
}

.resha-stock-qty-cell {
    min-width: 100px;
}

.resha-stock-qty {
    width: 100%;
    max-width: 100px;
    height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 8px;
}

.resha-stock-qty:disabled {
    opacity: 0.55;
}

.resha-stock-table td select {
    min-width: 130px;
    height: 36px;
    border-radius: 8px;
}

.resha-empty {
    padding: 26px 12px;
    text-align: center;
    color: #6b7280;
    margin: 0;
}

.resha-stock-gate {
    max-width: 740px;
    margin: 40px auto;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #991b1b;
    font-weight: 600;
}

@media (max-width: 900px) {
    .resha-controls-row {
        grid-template-columns: 1fr;
    }

    .resha-product-head-tools {
        flex-basis: 100%;
        justify-content: stretch;
    }

    .resha-product-head-tools .resha-toolbar-single-row {
        justify-content: flex-start;
    }

    .resha-stock-filters-inner {
        grid-template-columns: 1fr;
    }

    .resha-field-search {
        grid-column: span 1;
    }

    .resha-filter-actions {
        grid-column: span 1;
    }
}

/* Login gate (matches My Account hero + custom auth modal) */
.resha-stock-login-gate {
    text-align: center;
    padding: 60px 20px 50px;
    max-width: 520px;
    margin: 0 auto;
}

.resha-stock-login-gate .resha-stock-gate-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #0d0625, #1a103d);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 12px 32px rgba(13, 6, 37, 0.25);
}

.resha-stock-login-gate .resha-stock-gate-icon svg {
    width: 36px;
    height: 36px;
    stroke: #e1bc92;
    fill: none;
    stroke-width: 1.5;
}

.resha-stock-login-gate h2 {
    font-size: 28px;
    font-weight: 700;
    color: #0d0625;
    margin: 0 0 10px;
    letter-spacing: -0.5px;
}

.resha-stock-login-gate p {
    font-size: 15px;
    color: #777;
    margin: 0 0 28px;
    line-height: 1.6;
}

.resha-stock-login-gate .resha-stock-gate-btn {
    display: inline-block;
    padding: 16px 48px;
    background: linear-gradient(135deg, #0d0625 0%, #1a103d 100%);
    color: #e1bc92;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    text-decoration: none;
}

.resha-stock-login-gate .resha-stock-gate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(13, 6, 37, 0.35);
    color: #e1bc92;
}

.resha-stock-login-gate--denied .resha-stock-gate-icon {
    background: linear-gradient(135deg, #451a1a, #7f1d1d);
}

.resha-stock-login-gate--denied h2 {
    color: #7f1d1d;
}
