.services-page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.services-page-heading h2 { margin: 0; font-size: 24px; color: var(--text-primary); }
.services-count { color: var(--text-secondary); font-size: 13px; }
body.console-refresh .services-workspace { display: flex; flex-direction: column; min-width: 0; margin-top: 0; }
.service-editor-disclosure { min-width: 0; background: var(--bg-surface); }
.service-editor-disclosure > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 24px;
    cursor: pointer;
    list-style: none;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
}
.service-editor-disclosure > summary::-webkit-details-marker { display: none; }
.service-editor-disclosure > summary > span { display: inline-flex; align-items: center; gap: 10px; }
.service-editor-disclosure > summary > .fa-chevron-down { transition: transform 150ms ease; }
.service-editor-disclosure[open] > summary { border-bottom: 1px solid var(--border-color); }
.service-editor-disclosure[open] > summary > .fa-chevron-down { transform: rotate(180deg); }
.service-editor-disclosure > summary:focus-visible { outline: 2px solid #078058; outline-offset: -3px; }
body.console-refresh .service-editor-panel h2 { margin: 0 0 22px; }
.services-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; align-items: start; }
body.console-refresh .services-form-grid > .form-group { grid-column: span 1; margin: 0; min-width: 0; }
body.console-refresh .services-form-grid > .service-image-field { grid-column: 1 / -1; }
body.console-refresh .services-form-grid > .service-wide-field { grid-column: 1 / -1; }
body.console-refresh .services-form-grid > .service-half-field { grid-column: span 1; }
.services-form-grid .form-input, .services-form-grid .select-input { width: 100%; margin: 0; min-height: 42px; }
.services-form-grid textarea.form-input { min-height: 120px; }
.services-form-grid .form-group > label { display: block; margin-bottom: 7px; line-height: 1.5; }
.service-fields-section, .service-bundle-section { border-top: 1px solid var(--border-color); padding-top: 20px; }
.service-form-section-heading + .service-fields-section { border-top: 0; padding-top: 2px; }
.services-form-grid .product-field-options { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 10px !important; }
.services-form-grid input[type="checkbox"],
body.console-refresh .services-form-grid input[type="checkbox"] {
    appearance: auto;
    width: 16px !important;
    max-width: 16px !important;
    height: 16px;
    min-height: 16px;
    flex: 0 0 16px;
    margin: 0;
    padding: 0;
    accent-color: #078058;
}
.service-form-section-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 4px;
    padding: 14px 0 2px;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
}
.service-form-section-heading:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.service-form-section-heading i { width: 16px; color: #078058; text-align: center; }
.service-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.service-section-heading label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-primary) !important; font-size: 14px !important; }
.service-section-heading > span { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.service-bundle-search { position: relative; margin-bottom: 12px; }
.service-bundle-search > i { position: absolute; left: 13px; top: 14px; color: var(--text-secondary); }
.service-bundle-search .form-input { padding-left: 36px; }
.bundle-constituents-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.bundle-product-option { display: flex; align-items: flex-start; gap: 9px; padding: 11px 8px; margin: 0; min-width: 0; cursor: pointer; border-bottom: 1px solid var(--border-color); }
.bundle-product-option:hover { background: var(--bg-input); }
.bundle-product-option.is-selected { background: rgba(7, 128, 88, .08); }
.bundle-product-option > input { margin-top: 3px; }
.bundle-product-option > span { min-width: 0; display: grid; gap: 3px; }
.bundle-product-option strong { color: var(--text-primary); font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.bundle-product-option small { color: var(--text-secondary); font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.bundle-product-option[hidden], .service-picker-empty[hidden] { display: none !important; }
.service-picker-empty { padding: 18px 0; color: var(--text-secondary); font-size: 13px; }
.service-image-preview { display: flex; align-items: center; gap: 12px; min-height: 76px; margin-top: 12px; color: var(--text-secondary); font-size: 12px; }
.service-image-preview[hidden] { display: none; }
.service-image-preview img { width: 72px; height: 72px; object-fit: contain; background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 6px; }
.service-image-preview[data-status="loaded"] { color: #078058; }
.service-image-preview[data-status="error"] { color: #dc3545; }
.service-image-preview[data-status="error"] img { display: none; }
.service-image-divider { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--text-secondary); font-size: 11px; text-transform: uppercase; }
.service-image-divider::before, .service-image-divider::after { content: ''; height: 1px; flex: 1; background: var(--border-color); }
.service-image-upload { display: flex !important; align-items: center; gap: 12px; min-height: 68px; margin: 0 !important; padding: 12px 14px; border: 1px dashed #078058; border-radius: 7px; background: rgba(7, 128, 88, .05); cursor: pointer; }
.service-image-upload > i { color: #078058; font-size: 22px; }
.service-image-upload > span { display: grid; gap: 3px; }
.service-image-upload strong { color: var(--text-primary); font-size: 13px; }
.service-image-upload small { color: var(--text-secondary); font-size: 11px; }
.service-image-upload:hover { background: rgba(7, 128, 88, .1); }
.service-addon-fields { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.service-addon-fields[style*="block"] { display: grid !important; }
.service-addon-fields .form-group { margin: 0 !important; min-width: 0; }
.service-save-button, #cancel-edit-product-btn { grid-column: span 3; width: 100%; margin: 0 !important; min-height: 42px; }
.service-save-button:only-of-type { grid-column: 1 / -1; max-width: 280px; justify-self: end; }
body.console-refresh .services-list-panel { padding: 24px !important; }
body.console-refresh .services-list-panel h3 { color: var(--text-primary) !important; }
.services-table { min-width: 1040px; }
.services-table td { vertical-align: middle; }
.services-table .code-font { font-size: 11px; overflow-wrap: anywhere; }
.services-table .actions-cell { display: flex; gap: 6px; justify-content: flex-end; }
.services-table .actions-cell button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: auto; min-width: 38px; padding: 7px 9px; }
.services-table .actions-cell button span { font-size: 11px; font-weight: 700; }
.services-table .guidance-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.services-table td:nth-child(2) { min-width: 180px; max-width: 280px; white-space: normal; }
.services-table td:nth-child(2) strong { overflow-wrap: anywhere; }

body.console-refresh .services-form-grid .product-field-options label,
body.console-refresh .services-form-grid .service-check-option,
body.console-refresh .service-toggle-option {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    min-width: 0;
    min-height: 38px;
    margin: 0 !important;
    padding: 9px 11px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary) !important;
    cursor: pointer;
    text-transform: none !important;
    letter-spacing: 0 !important;
}
body.console-refresh .services-form-grid .service-check-option > span { min-width: 0; line-height: 1.35; }
body.console-refresh .service-toggle-option > span { display: grid; gap: 2px; min-width: 0; }
body.console-refresh .service-toggle-option strong { font-size: 13px; line-height: 1.35; }
body.console-refresh .service-toggle-option small { color: var(--text-secondary); font-size: 11px; line-height: 1.4; }
body.console-refresh .bundle-constituents-picker { max-height: none; gap: 10px; overflow: visible; }
body.console-refresh .bundle-product-option {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-surface);
    text-transform: none !important;
    letter-spacing: 0 !important;
}
body.console-refresh .bundle-product-option[hidden] { display: none !important; }
body.console-refresh .services-table .actions-cell {
    display: grid;
    grid-template-columns: repeat(2, 34px);
    gap: 5px;
    justify-content: end;
}
body.console-refresh .services-table .actions-cell button {
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
}
body.console-refresh .services-table .actions-cell button span { display: none; }

@media (max-width: 1100px) {
    .services-form-grid { grid-template-columns: minmax(0, 1fr); }
    body.console-refresh .services-form-grid > .form-group,
    body.console-refresh .services-form-grid > .service-half-field { grid-column: 1 / -1; }
    body.console-refresh .services-form-grid > .service-wide-field,
    body.console-refresh .services-form-grid > .service-image-field { grid-column: 1 / -1; }
    .bundle-constituents-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .services-page-heading { align-items: flex-start; }
    .services-page-heading h2 { font-size: 21px; }
    .service-editor-disclosure > summary { padding: 16px 18px; }
    .services-form-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .services-form-grid > * { width: 100%; min-width: 0; grid-column: 1 / -1; }
    .services-form-grid .product-field-options { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    .bundle-constituents-picker { grid-template-columns: 1fr; max-height: 280px; }
    .service-addon-fields { grid-template-columns: 1fr; }
    .service-save-button:only-of-type { max-width: none; }
    body.console-refresh .services-list-panel { padding: 18px !important; }
    .services-list-panel .table-wrapper { overflow: visible !important; }
    .services-table { min-width: 0; width: 100%; display: block; }
    .services-table thead { display: none; }
    .services-table tbody { display: grid; gap: 12px; }
    .services-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 14px;
        padding: 14px;
        border: 1px solid var(--border-color);
        background: var(--bg-surface);
    }
    .services-table td {
        display: grid;
        grid-template-columns: 1fr;
        gap: 4px;
        min-width: 0 !important;
        max-width: none !important;
        padding: 9px 0 !important;
        border: 0 !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }
    .services-table td::before { color: var(--text-secondary); font-size: 10px; font-weight: 700; text-transform: uppercase; }
    .services-table td:nth-child(1) { display: none; }
    .services-table td:nth-child(2),
    .services-table td:nth-child(3),
    .services-table td:nth-child(9),
    .services-table td:nth-child(10) { grid-column: 1 / -1; }
    .services-table td:nth-child(2)::before { content: 'Service ID'; }
    .services-table td:nth-child(3)::before { content: 'Service'; }
    .services-table td:nth-child(4)::before { content: 'Category'; }
    .services-table td:nth-child(5)::before { content: 'Duration'; }
    .services-table td:nth-child(6)::before { content: 'Retail'; }
    .services-table td:nth-child(7)::before { content: 'Reseller'; }
    .services-table td:nth-child(8)::before { content: 'Add-on'; }
    .services-table td:nth-child(9)::before { content: 'Rules and guide'; }
    .services-table td:nth-child(10)::before { content: 'Actions'; }
    .services-table .actions-cell { justify-content: flex-start; }
}

/* Configured Services stays a compact horizontal table on phones. */
@media (max-width: 620px) {
    body.console-refresh .services-list-panel .table-wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
    }
    body.console-refresh .services-list-panel .services-table {
        display: table !important;
        width: 100% !important;
        min-width: 900px !important;
        table-layout: fixed;
    }
    body.console-refresh .services-list-panel .services-table thead {
        display: table-header-group !important;
    }
    body.console-refresh .services-list-panel .services-table tbody {
        display: table-row-group !important;
    }
    body.console-refresh .services-list-panel .services-table tr {
        display: table-row !important;
        padding: 0 !important;
        border: 0 !important;
        background: transparent !important;
    }
    body.console-refresh .services-list-panel .services-table th,
    body.console-refresh .services-list-panel .services-table td {
        display: table-cell !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 7px 6px !important;
        border-bottom: 1px solid var(--border-color) !important;
        font-size: 10px;
        line-height: 1.35;
        white-space: normal !important;
        vertical-align: middle;
    }
    body.console-refresh .services-list-panel .services-table td::before { display: none !important; content: none !important; }
    body.console-refresh .services-list-panel .services-table td:nth-child(1) { display: table-cell !important; }
    body.console-refresh .services-list-panel .services-table .actions-cell { justify-content: center; }
    body.console-refresh .services-list-panel .services-table .actions-cell button { width: 28px; min-width: 28px; height: 28px; }
}
