/* JavaScript Manager Customizer UI */
body.wp-core-ui.wp-customizer {
  .ag-js-manager-wrapper {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    padding-bottom: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 72vh;
    max-height: calc(100vh - 140px);
    overflow: visible;
  }

  .ag-file-manager-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    position: relative;
    z-index: 2;
    background: #fff;
    padding: 0;
  }

  .ag-manager-tab {
    appearance: none;
    border: 1px solid #ccd0d4;
    background: #f6f7f7;
    color: #2c3338;
    border-radius: 6px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .ag-manager-tab .ag-tab-pending {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(214, 54, 56, 0.12);
    color: #d63638;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
  }

  .ag-manager-tab:hover {
    border-color: #8c8f94;
  }

  .ag-manager-tab.is-active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
  }

  .ag-manager-tab.is-active .ag-tab-pending {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
  }

  /* Upload Section */
  .ag-js-upload-section {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eee;
  }

  .ag-js-upload-section h4 {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #333;
  }

  .ag-file-upload {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .ag-js-file-input {
    flex: 1;
    min-width: 200px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
  }

  .ag-js-upload-section .button {
    white-space: nowrap;
  }

  .ag-font-import-section {
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid #dbe4ec;
    border-radius: 6px;
    background: #f8fbff;
  }

  .ag-font-import-section h4 {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #1f2933;
  }

  .ag-font-import-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    align-items: center;
  }

  .ag-font-import-input {
    min-height: 32px;
    border: 1px solid #d0d7df;
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .ag-font-import-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
  }

  .ag-font-import-section .description {
    margin: 8px 0 0;
    font-size: 11px;
    line-height: 1.4;
  }

  .ag-root-vars-section {
    margin-bottom: 18px;
    padding: 12px;
    border: 1px solid #dbe4ec;
    border-radius: 6px;
    background: #f7fbff;
  }

  .ag-root-vars-section h4 {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #1f2933;
  }

  .ag-root-vars-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    margin-bottom: 10px;
  }

  .ag-root-vars-row {
    display: grid;
    grid-template-columns: minmax(130px, 1fr) auto auto auto;
    gap: 8px;
    align-items: center;
  }

  #ag-root-vars-scan-url {
    width: 100%;
  }

  .ag-root-vars-manual {
    width: 100%;
    min-height: 74px;
    border: 1px solid #d0d7df;
    border-radius: 4px;
    padding: 7px 8px;
    font-size: 12px;
    line-height: 1.4;
    resize: vertical;
  }

  .ag-root-vars-manual:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
  }

  .ag-rootvar-item .ag-rootvar-meta-row {
    align-items: center;
    gap: 10px;
  }

  .ag-root-action-select {
    min-width: 120px;
    min-height: 28px;
    border: 1px solid #d8d8d8;
    border-radius: 3px;
    font-size: 12px;
    color: #333;
    background: #fff;
  }

  .ag-root-action-select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
  }

  .ag-root-nonblockable {
    font-size: 11px;
    color: #6b7280;
  }

  .ag-root-vars-values {
    width: 100%;
    min-height: 74px;
    margin-top: 8px;
    border: 1px solid #d8d8d8;
    border-radius: 4px;
    background: #fff;
    padding: 7px 8px;
    font-size: 12px;
    line-height: 1.35;
    font-family: inherit;
    resize: vertical;
  }

  .ag-root-vars-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
  }

  .ag-root-vars-actions .button {
    min-height: 28px;
  }

  .ag-root-blocked-group {
    list-style: none;
    margin: 0 0 12px;
    padding: 10px;
    border: 1px solid #dbe4ec;
    border-radius: 6px;
    background: #f7fbff;
  }

  .ag-root-blocked-header {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #1f2933;
    margin-bottom: 4px;
  }

  .ag-root-blocked-help {
    font-size: 11px;
    color: #52606d;
    margin-bottom: 8px;
  }

  .ag-root-blocked-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
  }

  .ag-root-blocked-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border: 1px solid #e5edf3;
    border-radius: 4px;
    background: #fff;
  }

  .ag-root-blocked-name {
    font-size: 12px;
    font-weight: 600;
    color: #1f2933;
    word-break: break-word;
  }

  @media (max-width: 560px) {
    .ag-root-vars-row {
      grid-template-columns: 1fr 1fr;
    }

    .ag-root-vars-row .button {
      width: 100%;
    }
  }

  #ag-upload-status {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 3px;

    color: #155724;
    border: 1px solid #c3e6cb;
  }

  #ag-upload-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
  }

  #ag-upload-status.loading {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
  }

  /* Files List Section */
  .ag-js-files-section {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    min-height: 260px;
    flex: 1 1 auto;
    overflow-y: auto;
    resize: vertical;
  }

  .ag-js-files-section h4 {
    margin: 0 0 10px 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #333;
  }

  .ag-js-files-list {
    list-style: none;
    margin: 0 0 15px 0;
    padding: 0;
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 3px;
    min-height: 240px;
    max-height: none;
    overflow-y: visible;
    resize: none;
    flex: 1 1 auto;
  }

  .ag-js-files-list.ag-sort-disabled .ag-file-drag-handle {
    opacity: 0.35;
    cursor: default;
  }

  .ag-empty-state {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    font-size: 13px;
  }

  .ag-loading-state {
    color: #4b5563;
    font-style: normal;
    opacity: 0.9;
  }

  /* File Item */
  .ag-file-item {
    display: block;
    padding: 9px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    transition: background-color 0.2s;
    user-select: none;
  }

  .ag-file-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
  }

  .ag-file-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding-left: 30px;
    min-width: 0;
  }

  .ag-file-disabled {
    opacity: 0.55;
  }

  .ag-file-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 0;
    font-size: 10px;
    white-space: nowrap;
    color: #444;
    user-select: none;
  }

  .ag-file-toggle input {
    margin: 0;
  }

  .ag-file-deps-row {
    margin-top: 7px;
    padding-left: 30px;
  }

  .ag-file-loading-row {
    margin-top: 7px;
    padding-left: 30px;
    display: flex;
    gap: 10px;
  }

  .ag-loading-col {
    flex: 1;
    min-width: 120px;
  }

  .ag-loading-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 4px;
  }

  .ag-load-position-select,
  .ag-load-strategy-select {
    width: 100%;
    min-height: 28px;
    border: 1px solid #d8d8d8;
    border-radius: 3px;
    font-size: 12px;
    color: #333;
    background: #fff;
  }

  .ag-env-select {
    width: 100%;
    min-height: 28px;
    border: 1px solid #d8d8d8;
    border-radius: 3px;
    font-size: 12px;
    color: #333;
    background: #fff;
  }

  .ag-route-scope-select {
    width: 100%;
    min-height: 28px;
    border: 1px solid #d8d8d8;
    border-radius: 3px;
    font-size: 12px;
    color: #333;
    background: #fff;
  }

  .ag-load-position-select:focus,
  .ag-load-strategy-select:focus,
  .ag-env-select:focus,
  .ag-route-scope-select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
  }

  .ag-loading-help {
    margin-top: 4px;
    padding-left: 30px;
    font-size: 10px;
    line-height: 1.4;
    color: #6b7280;
  }

  .ag-deps-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 4px;
  }

  .ag-deps-picker-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .ag-deps-select {
    flex: 1;
    min-height: 28px;
    min-width: 0;
    width: 100%;
    max-width: none;
    border: 1px solid #d8d8d8;
    border-radius: 3px;
    font-size: 12px;
    color: #333;
    background: #fff;
  }

  .ag-deps-select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
  }

  .ag-deps-add-btn {
    white-space: nowrap;
  }

  .ag-deps-current-label {
    margin-top: 6px;
    font-size: 10px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
  }

  .ag-deps-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
  }

  .ag-deps-empty {
    font-size: 12px;
    color: #8a8a8a;
    font-style: italic;
  }

  .ag-dep-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #eef4ff;
    color: #1d3f72;
    border: 1px solid #c9dcff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 10px;
    line-height: 1.4;
  }

  .ag-chip-remove {
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
  }

  .ag-chip-remove[disabled],
  .ag-deps-select[disabled],
  .ag-deps-add-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
  }

  .ag-file-item:last-child {
    border-bottom: none;
  }

  .ag-file-item:hover {
    background: #f5f5f5;
  }

  .ag-file-item.ag-file-ghost {
    opacity: 0.5;
    background: #e8e8e8;
  }

  .ag-file-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    color: #999;
    cursor: grab;
    margin-right: 6px;
    font-size: 16px;
    user-select: none;
    flex-shrink: 0;
  }

  .ag-file-drag-handle:active {
    cursor: grabbing;
  }

  .ag-file-item:active .ag-file-drag-handle {
    cursor: grabbing;
  }

  .ag-font-map-item {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
  }

  .ag-font-map-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #f8fafc;
  }

  .ag-font-map-file {
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
    word-break: break-word;
  }

  .ag-font-map-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
    word-break: break-word;
  }

  /* File Name */
  .ag-file-name {
    flex: 1 1 180px;
    min-width: 0;
    font-size: 12px;
    font-weight: 500;
    color: #333;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    line-height: 1.25;
    margin-right: 4px;
  }

  /* File Location Badge */
  .ag-file-location {
    display: inline-block;
    padding: 2px 7px;
    background: #e8f0f7;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: #0066cc;
    text-transform: uppercase;
    margin-right: 6px;
    flex-shrink: 0;
  }

  .ag-file-location {
    background: #f0f0f0;
    color: #666;
  }

  .ag-file-item:has(.ag-file-protected.show) .ag-file-location {
    background: #fef3cd;
    color: #856404;
  }

  /* Protected Badge */
  .ag-file-protected {
    display: none;
    font-size: 14px;
    margin-right: 6px;
    flex-shrink: 0;
    cursor: help;
  }

  .ag-file-protected.show {
    display: inline-block;
  }

  .ag-env-warning {
    display: none;
    margin-right: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: #fff4e5;
    color: #8a4b00;
    border: 1px solid #ffd8a8;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.3;
    cursor: help;
  }

  .ag-env-warning.show {
    display: inline-flex;
    align-items: center;
  }

  /* Delete Button */
  .ag-file-delete {
    padding: 4px 8px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #d9534f;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition:
      background-color 0.2s,
      border-color 0.2s;
    flex-shrink: 0;
  }

  .ag-file-delete:hover {
    background: #d9534f;
    border-color: #ac2925;
    color: #fff;
  }

  /* Action Buttons */
  .ag-files-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 0;
  }

  .ag-js-files-section .button {
    margin-right: 0;
    margin-bottom: 0;
  }

  .ag-manager-footer {
    position: relative;
    margin: 10px 0 0;
    padding: 8px 0;
    border-top: 1px solid #d9d9d9;
    background: #ffffff;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    z-index: 2;
  }

  .ag-jump-actions {
    display: inline-flex;
    gap: 4px;
    align-items: center;
  }

  .ag-jump-btn {
    min-width: 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px;
  }

  .ag-drop-overlay {
    position: absolute;
    inset: 0;
    background: rgba(16, 185, 129, 0.1);
    border: 2px dashed rgba(16, 185, 129, 0.7);
    border-radius: 4px;
    z-index: 6;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }

  .ag-js-manager-wrapper.ag-drop-active .ag-drop-overlay {
    display: flex;
  }

  .ag-drop-overlay-inner {
    background: #fff;
    border: 1px solid #10b981;
    color: #065f46;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
  }

  .ag-file-item.ag-file-new {
    animation: agFileNewFade 1.8s ease-out;
  }

  @keyframes agFileNewFade {
    0% {
      background: #d1fae5;
    }
    100% {
      background: #fff;
    }
  }

  .ag-manager-footer-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
  }

  .ag-footer-title {
    font-size: 11px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.25;
  }

  .ag-footer-sub {
    font-size: 10px;
    color: #6b7280;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 210px;
  }

  .ag-files-actions .button.button-primary {
    background: #198754;
    border-color: #198754;
  }

  .ag-files-actions .button.button-primary:hover {
    background: #157347;
    border-color: #157347;
  }

  .ag-files-actions .button.ag-soft {
    background: #f8f9fa;
    border-color: #ced4da;
    color: #495057;
  }

  .ag-files-actions .button.ag-soft.is-pending {
    border-color: #f59e0b;
    color: #92400e;
    background: #fff7ed;
  }

  .ag-files-actions .button.ag-soft:hover {
    background: #e9ecef;
    border-color: #adb5bd;
  }

  .ag-mode-quick .ag-file-advanced-block {
    display: none;
  }

  .ag-mode-advanced .ag-file-advanced-block {
    display: block;
  }

  .button.ag-danger {
    color: #d9534f;
    border-color: #d9534f;
    background: #fff;
  }

  .button.ag-danger:hover {
    background: #d9534f;
    border-color: #ac2925;
    color: #fff;
  }

  /* Scrollbar Styling */
  .ag-js-files-list::-webkit-scrollbar {
    width: 8px;
  }

  .ag-js-files-list::-webkit-scrollbar-track {
    background: #f0f0f0;
  }

  .ag-js-files-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
  }

  .ag-js-files-list::-webkit-scrollbar-thumb:hover {
    background: #999;
  }

  /* Responsive */
  @media (max-width: 782px) {
    .ag-file-upload {
      flex-direction: column;
    }

    .ag-js-file-input {
      min-width: 100%;
    }

    .ag-file-location {
      display: none;
    }

    .ag-file-title-row {
      flex-wrap: wrap;
    }

    .ag-file-name {
      flex: 1 1 100%;
      margin-right: 0;
    }

    .ag-file-meta-row {
      flex-wrap: wrap;
      padding-left: 0;
    }

    .ag-file-loading-row {
      flex-direction: column;
      padding-left: 0;
    }

    .ag-font-import-grid {
      grid-template-columns: 1fr;
    }

    .ag-jump-actions {
      order: 3;
    }

    .ag-file-deps-row,
    .ag-loading-help {
      padding-left: 0;
    }
  }

  /* ================================================================
   Divi CSS Capture Manager
   Scoped to .ag-divi-capture-wrapper — reuses File Manager classes
   ================================================================ */

  /* Scope headings inside the <ul> (core tab: global / per-page) */
  .ag-divi-scope-heading {
    list-style: none;
    margin: 0;
    padding: 8px 12px;
    background: #f0f4f8;
    border-bottom: 1px solid #e0e0e0;
    border-left: 3px solid #2271b1;
    font-size: 11px;
    font-weight: 600;
    color: #1f2937;
  }

  .ag-divi-scope-heading.ag-divi-scope-perpage {
    border-left-color: #8c8f94;
  }

  .ag-divi-scope-heading.ag-divi-scope-original {
    background: #fdf2f2;
    border-left-color: #d63638;
    color: #8b1a1a;
  }

  .ag-divi-scope-heading.ag-divi-scope-merged {
    background: #f3f0ff;
    border-left-color: #7c3aed;
    color: #4c1d95;
  }

  .ag-scope-desc {
    font-weight: 400;
    color: #6b7280;
  }

  /* Target-file badge in Divi items should not be uppercased */
  .ag-divi-capture-wrapper .ag-file-location {
    text-transform: none;
  }

  /* Drag handle placeholder (non-sortable) */
  .ag-divi-capture-wrapper .ag-file-drag-handle {
    cursor: default;
    opacity: 0.45;
  }

  /* --- Merged CSS container --- */
  .ag-merge-wrapper {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .ag-merge-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .ag-merge-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f9f7ff;
    border-bottom: 1px solid #e8e0f7;
    font-size: 11px;
    color: #1f2937;
    cursor: default;
  }

  .ag-merge-item:last-child {
    border-bottom: none;
  }

  .ag-merge-drag {
    cursor: grab;
    font-size: 14px;
    color: #7c3aed;
    user-select: none;
    padding: 0 2px;
  }

  .ag-merge-drag:active {
    cursor: grabbing;
  }

  .ag-merge-name {
    flex: 1;
    font-weight: 500;
  }

  .ag-merge-remove {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 12px;
    padding: 0 4px;
    line-height: 1;
  }

  .ag-merge-remove:hover {
    color: #d63638;
  }

  .ui-sortable-helper.ag-merge-item {
    background: #ede9fe;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
  }

  .ui-sortable-placeholder {
    height: 28px;
    background: #f3f0ff;
    border: 1px dashed #c4b5fd;
    visibility: visible !important;
  }

  /* Merge toggle styling */
  .ag-divi-toggle-merge span {
    font-size: 11px;
    color: #7c3aed;
  }

  /* Status areas */
  .ag-divi-save-status,
  .ag-divi-refresh-status {
    margin-top: 8px;
  }

  /* --- Dual checkbox row (Disable + Capture) --- */
  .ag-divi-dual-controls {
    display: flex;
    gap: 14px;
    align-items: center;
  }

  .ag-divi-toggle-disable span,
  .ag-divi-toggle-capture span {
    font-size: 11px;
  }

  /* --- File info + Delete row --- */
  .ag-divi-file-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    padding-top: 3px;
  }

  .ag-divi-file-info {
    font-size: 10.5px;
    color: #6b7280;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ag-divi-file-info.ag-divi-file-exists {
    color: #46b450;
  }

  .ag-divi-file-info.ag-divi-file-missing {
    color: #8c8f94;
    font-style: italic;
  }

  .ag-divi-delete-btn {
    flex-shrink: 0;
    padding: 1px 8px;
    font-size: 10.5px;
    line-height: 1.6;
    border: 1px solid #d63638;
    border-radius: 3px;
    background: transparent;
    color: #d63638;
    cursor: pointer;
    transition:
      background 0.15s,
      color 0.15s;
  }

  .ag-divi-delete-btn:hover:not(:disabled) {
    background: #d63638;
    color: #fff;
  }

  .ag-divi-delete-btn:disabled,
  .ag-divi-delete-btn.ag-divi-delete-disabled {
    opacity: 0.35;
    cursor: default;
    border-color: #8c8f94;
    color: #8c8f94;
  }

  /* ================================================================
   Pages Tab
   ================================================================ */

  /* Toolbar (Capture All + Reload) */
  .ag-divi-pages-toolbar {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: #f9fafb;
  }

  /* Per-page handle selection row */
  .ag-pp-handle-selection-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    padding: 7px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: #f4f6f8;
    font-size: 12px;
  }
  .ag-pp-selection-label {
    font-weight: 600;
    color: #444;
    margin-right: 2px;
  }
  .ag-pp-handle-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: #555;
    white-space: nowrap;
  }
  .ag-pp-handle-label input[type='checkbox'] {
    margin: 0;
  }

  /* Pages list */
  .ag-divi-pages-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 420px;
    overflow-y: auto;
  }

  /* Single page item */
  .ag-divi-page-item {
    padding: 10px 12px;
    border-bottom: 1px solid #e8e8e8;
    transition: background 0.12s;
  }

  .ag-divi-page-item:hover {
    background: #f7f9fb;
  }

  .ag-divi-page-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
  }

  .ag-divi-page-title {
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ag-divi-page-meta {
    font-size: 10px;
    color: #8c8f94;
    flex-shrink: 0;
  }

  .ag-divi-page-url {
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Per-page files list */
  .ag-divi-pp-files {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-bottom: 6px;
  }

  .ag-divi-pp-file {
    font-size: 10.5px;
    color: #6b7280;
  }

  .ag-divi-pp-file.ag-divi-file-exists {
    color: #46b450;
  }

  .ag-divi-pp-file.ag-divi-file-missing {
    color: #8c8f94;
    font-style: italic;
  }

  /* Page action buttons */
  .ag-divi-page-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
  }

  .ag-divi-page-capture-btn {
    font-size: 11px !important;
    padding: 1px 10px !important;
    line-height: 1.6 !important;
  }

  .ag-divi-page-delete-btn {
    flex-shrink: 0;
    padding: 1px 8px;
    font-size: 10.5px;
    line-height: 1.6;
    border: 1px solid #d63638;
    border-radius: 3px;
    background: transparent;
    color: #d63638;
    cursor: pointer;
    transition:
      background 0.15s,
      color 0.15s;
  }

  .ag-divi-page-delete-btn:hover:not(:disabled) {
    background: #d63638;
    color: #fff;
  }

  .ag-divi-page-delete-btn:disabled {
    opacity: 0.35;
    cursor: default;
    border-color: #8c8f94;
    color: #8c8f94;
  }

  /* Pages status area */
  .ag-divi-pages-status {
    margin-top: 8px;
    padding: 0 12px 10px;
  }
}

/* ─── Handle model ─────────────────────────────────────────────────────────
   What a stylesheet IS, shown on its row. The panel used to present ten
   identical rows with two checkboxes each, leaving the operator to remember
   which sheets overlap, which emit nothing on this builder version, and which
   supersede others. These render the measured facts instead.
   ------------------------------------------------------------------------ */

.ag-hm {
	margin-top: 6px;
	padding-top: 6px;
	border-top: 1px dotted rgba(255, 255, 255, .12);
}

.ag-hm-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 4px;
}

.ag-hm-pill {
	font-size: 9px;
	letter-spacing: .06em;
	text-transform: uppercase;
	padding: 1px 5px;
	border: 1px solid rgba(255, 255, 255, .22);
	color: rgba(255, 255, 255, .62);
	white-space: nowrap;
	border-radius: 2px;
}

.ag-hm-scope-pp { border-color: #7a8c10; color: #b7d02a; }
.ag-hm-scope-gl { border-color: #4a6670; color: #8fb3be; }

/* Not a failure state: these handles are legitimately absent or inert. */
.ag-hm-role-conditional { border-color: #8a6a12; color: #d8b24a; }
.ag-hm-role-empty       { border-color: #8a6a12; color: #d8b24a; }
.ag-hm-role-plugin      { border-color: rgba(255, 255, 255, .22); }

.ag-hm-note {
	font-size: 11px;
	line-height: 1.45;
	color: rgba(255, 255, 255, .55);
}

.ag-hm-rel {
	font-size: 11px;
	line-height: 1.5;
	margin-top: 3px;
	color: rgba(255, 255, 255, .7);
}

.ag-hm-rel code,
.ag-hm-conflict code {
	font-size: 10.5px;
	padding: 0 3px;
	background: rgba(255, 255, 255, .08);
	border-radius: 2px;
}

/* Fires only when both sheets are actually selected — see renderHandleConflicts. */
.ag-hm-conflict {
	margin-top: 6px;
	padding: 7px 9px;
	font-size: 11.5px;
	line-height: 1.45;
	color: #f2e3c7;
	background: rgba(138, 106, 18, .18);
	border: 1px solid rgba(216, 178, 74, .5);
	border-radius: 2px;
}

.ag-hm-conflict strong { color: #f6d98a; }
