/* ── Spellmatic Admin Dashboard Styles ──────────────────────────────────── */

.spellmatic-wrap {
    max-width: 1100px;
}

/* Header */
.spellmatic-header {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 16px;
    border-bottom: 3px solid #2E75B6;
    padding-bottom: 12px;
}

.spellmatic-header h1 {
    color: #1F4E79;
    margin: 0;
}

.spellmatic-tagline {
    color: #595959;
    margin: 0;
    font-size: 14px;
}

/* Scan panel */
.spellmatic-scan-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
}

#spellmatic-scan-btn {
    background: #2E75B6 !important;
    border-color: #1F4E79 !important;
    color: #fff !important;
    font-size: 16px !important;
    padding: 12px 32px !important;
    height: auto !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#spellmatic-scan-btn:hover {
    background: #1F4E79 !important;
}

#spellmatic-scan-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Progress bar */
.spellmatic-progress {
    margin-top: 20px;
}

.spellmatic-progress-bar {
    width: 100%;
    background: #E5E5E5;
    border-radius: 6px;
    height: 12px;
    overflow: hidden;
}

.spellmatic-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2E75B6, #2ECC71);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.spellmatic-progress p {
    color: #595959;
    font-size: 13px;
    margin: 8px 0 0;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Results container */
.spellmatic-results-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 24px;
}

.spellmatic-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.spellmatic-results-header h2 {
    margin: 0;
    color: #1F4E79;
}

/* ── Result cards ─────────────────────────────────────────────────────────── */
.spellmatic-result-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #fff;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.spellmatic-result-row:hover {
    background: #F8FBFF;
    box-shadow: 0 2px 8px rgba(46,117,182,0.08);
}

.spellmatic-result-row.spellmatic-resolved {
    opacity: 0.35;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Top bar: badge + post location */
.spellmatic-result-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.spellmatic-location {
    color: #888;
    font-size: 12px;
}

/* Context sentence with error highlighted */
.spellmatic-result-context {
    font-size: 13px;
    color: #444;
    font-style: italic;
    line-height: 1.55;
    background: #FAFAFA;
    border-left: 3px solid #D5D5D5;
    padding: 6px 10px;
    border-radius: 0 4px 4px 0;
}

.spellmatic-context-label {
    font-style: normal;
    font-weight: 600;
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-right: 4px;
}

/* The problematic word highlighted in the context */
mark.spellmatic-error-mark {
    background: #FDEDEC;
    color: #C0392B;
    border-radius: 2px;
    padding: 0 2px;
    font-style: normal;
    font-weight: 600;
    text-decoration: line-through;
}

/* Fix row: original word → editable input → buttons */
.spellmatic-fix-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.spellmatic-original-word {
    background: #FDEDEC;
    color: #C0392B;
    padding: 3px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    font-weight: 600;
    text-decoration: line-through;
    white-space: nowrap;
}

.spellmatic-arrow-icon {
    color: #999;
    font-size: 16px;
    flex-shrink: 0;
}

/* Editable correction input — user can change the suggestion before applying */
.spellmatic-fix-input {
    border: 1px solid #2E75B6 !important;
    border-radius: 4px !important;
    padding: 4px 10px !important;
    font-family: monospace !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #1E6B35 !important;
    background: #EAFAF1 !important;
    min-width: 120px;
    max-width: 300px;
    flex: 1 1 120px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    height: auto !important;
}

.spellmatic-fix-input:focus {
    border-color: #1F4E79 !important;
    box-shadow: 0 0 0 2px rgba(31,78,121,0.15) !important;
    outline: none !important;
}

.spellmatic-fix-input:empty,
.spellmatic-fix-input[value=""] {
    background: #fff !important;
    color: #777 !important;
}

/* Buttons inline with input */
.spellmatic-fix-row .button {
    white-space: nowrap;
    flex-shrink: 0;
}
.spellmatic-dict-add-inline {
    display: inline-flex !important;
    align-items: center;
    font-size: 12px !important;
    padding: 2px 8px !important;
    height: auto !important;
    line-height: 1.6 !important;
    color: #2271b1 !important;
    border-color: #2271b1 !important;
}
.spellmatic-dict-add-inline:hover {
    background: #2271b1 !important;
    color: #fff !important;
}

/* Old selectors kept for any stray references */
.spellmatic-original {
    background: #FDEDEC;
    color: #C0392B;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 13px;
    text-decoration: line-through;
}

.spellmatic-suggestion {
    background: #EAFAF1;
    color: #1E8449;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 13px;
    font-weight: 600;
}

.spellmatic-arrow {
    color: #aaa;
}

/* No errors */
.spellmatic-no-errors {
    text-align: center;
    color: #1E8449;
    font-size: 16px;
    padding: 32px;
}

/* No NEW errors (re-scan with all duplicates) */
.spellmatic-no-new-errors {
    text-align: center;
    padding: 28px 20px;
    font-size: 14px;
    color: #374151;
}

.spellmatic-no-new-errors p:first-child {
    color: #1E8449;
    font-size: 16px;
    margin-bottom: 8px;
}

.spellmatic-no-new-errors .button {
    margin-left: 8px;
    vertical-align: baseline;
}

/* Inline diff preview in context column */
.spellmatic-diff-del {
    background: #fecaca;
    color: #991b1b;
    text-decoration: line-through;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 500;
}

.spellmatic-diff-ins {
    background: #bbf7d0;
    color: #166534;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
    margin-left: 2px;
}

/* Recently fixed table */
/* ── Unified results: fixed row styling ───────────────────────────────── */
.spellmatic-fixed-row {
    background: #f0fdf4 !important;
}
.spellmatic-fixed-row:hover {
    background: #e6f9ec !important;
}
.spellmatic-status-fixed {
    color: #16a34a;
    font-weight: 600;
    font-size: 12px;
    white-space: nowrap;
}
.spellmatic-status-open {
    color: #ea580c;
    font-weight: 500;
    font-size: 12px;
}
.spellmatic-dismissed-row {
    background: #f9fafb !important;
    opacity: 0.6;
}
.spellmatic-dismissed-row:hover {
    opacity: 0.85;
}
.spellmatic-status-dismissed {
    color: #9ca3af;
    font-weight: 500;
    font-size: 12px;
    font-style: italic;
}
.spellmatic-edited-note {
    color: #9ca3af;
    font-size: 11px;
    font-style: italic;
}

/* ── Inline undo after fix ───────────────────────────────────────────── */
.spellmatic-fixed-label {
    color: #16a34a;
    font-weight: 600;
    font-size: 12px;
    margin-right: 4px;
}
.spellmatic-undo-btn {
    font-size: 12px !important;
    color: #2271b1 !important;
    border-color: #2271b1 !important;
}
.spellmatic-undo-btn:hover {
    background: #f0f6fc !important;
}

/* ── Undo toast notification ─────────────────────────────────────────── */
.spellmatic-undo-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    z-index: 100001;
    animation: spellmatic-toast-in 0.3s ease;
}
.spellmatic-undo-toast-btn {
    background: transparent !important;
    color: #60a5fa !important;
    border: 1px solid #60a5fa !important;
    font-weight: 600 !important;
    cursor: pointer;
}
.spellmatic-undo-toast-btn:hover {
    background: rgba(96,165,250,0.15) !important;
}
.spellmatic-undo-toast-dismiss {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 4px;
    margin-left: -4px;
}
.spellmatic-undo-toast-dismiss:hover {
    color: #fff;
}
@keyframes spellmatic-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Info toast (non-error notification) */
.spellmatic-info-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #1e3a5f;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    z-index: 100001;
    animation: spellmatic-toast-in 0.3s ease;
    max-width: 480px;
    line-height: 1.4;
}
.spellmatic-info-toast .dashicons {
    color: #60a5fa;
    font-size: 18px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}
.spellmatic-info-toast-dismiss {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 0 0 4px;
    margin-left: auto;
    flex-shrink: 0;
}
.spellmatic-info-toast-dismiss:hover {
    color: #fff;
}

/* Backup warning modal */
.spellmatic-backup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100010;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: spellmatic-fade-in 0.2s ease;
}
.spellmatic-backup-modal {
    background: #fff;
    border-radius: 12px;
    padding: 28px 32px 24px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    text-align: center;
}
.spellmatic-backup-modal h3 {
    font-size: 16px;
    color: #1e293b;
}
.spellmatic-backup-icon {
    margin-bottom: 12px;
}
@keyframes spellmatic-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Badges */
.spellmatic-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 10px;
    background: #E8F4FD;
    color: #2E75B6;
}

.spellmatic-badge--spelling { background: #FDEDEC; color: #C0392B; }
.spellmatic-badge--grammar  { background: #FEF9E7; color: #B7950B; }
.spellmatic-badge--style    { background: #EBF5FB; color: #2E75B6; }
.spellmatic-badge--seo      { background: #EAFAF1; color: #1E8449; }
.spellmatic-badge--confidence-high { background: #D5F5E3; color: #1E8449; }
.spellmatic-badge--confidence-low  { background: #FDEBD0; color: #CA6F1E; }

/* Connected key indicator */
.spellmatic-key-connected {
    color: #1E8449;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

/* Results table (Results sub-page) */
.spellmatic-results-table {
    width: 100%;
}

.spellmatic-results-table .spellmatic-context {
    max-width: 300px;
    font-size: 12px;
    color: #777;
    font-style: italic;
}

.spellmatic-error  { color: #C0392B; }
.spellmatic-fix    { color: #1E8449; }

/* ── Post link row (View · Edit · Edit with Elementor · etc.) ─────────────── */
.spellmatic-post-links {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    margin-left: 4px;
}

.spellmatic-post-link {
    font-size: 11px;
    color: #2271b1;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.1s ease;
}

.spellmatic-post-link:hover,
.spellmatic-post-link:focus {
    color: #135e96;
    text-decoration: underline;
}

.spellmatic-link-sep {
    color: #bbb;
    font-size: 11px;
    padding: 0 2px;
    user-select: none;
}

/* ── Results page header (title + meta + clear button) ───────────────────── */
.spellmatic-results-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.spellmatic-results-page-header h1 {
    margin: 0;
}

.spellmatic-results-page-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.spellmatic-results-meta {
    font-size: 13px;
    color: #666;
}

.spellmatic-clear-btn {
    color: #C0392B !important;
    border-color: #C0392B !important;
}

.spellmatic-clear-btn:hover {
    background: #FDEDEC !important;
}

/* ── Phase 4: Custom Dictionary panel ────────────────────────────────────── */
.spellmatic-dict-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px 24px;
    max-width: 720px;
    margin-bottom: 24px;
}

.spellmatic-dict-add-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.spellmatic-dict-add-row input[type="text"] {
    flex: 1 1 240px;
    min-width: 200px;
}

.spellmatic-dict-status {
    font-size: 12px;
    color: #595959;
    flex-shrink: 0;
}

.spellmatic-dict-status--success { color: #1E8449; }
.spellmatic-dict-status--error   { color: #C0392B; }

.spellmatic-dict-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 32px;
}

.spellmatic-dict-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #EBF5FB;
    border: 1px solid #AED6F1;
    border-radius: 20px;
    padding: 3px 10px 3px 12px;
    font-size: 13px;
    color: #1F4E79;
    white-space: nowrap;
}

.spellmatic-dict-word {
    font-weight: 600;
}

.spellmatic-dict-remove {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 2px !important;
    margin: 0 !important;
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    color: #7FB3D3;
    transition: color 0.1s ease;
    flex-shrink: 0;
}

.spellmatic-dict-remove:hover {
    color: #C0392B !important;
}

.spellmatic-dict-empty {
    font-size: 13px;
    color: #999;
    font-style: italic;
    margin: 0;
}

/* ── Phase 4: Scan Digest panel ───────────────────────────────────────────── */
.spellmatic-digest-panel {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 20px 24px;
    max-width: 720px;
    margin-bottom: 24px;
}

.spellmatic-digest-table {
    margin-bottom: 16px;
}

.spellmatic-digest-table th {
    padding-left: 0 !important;
    width: 160px;
}

.spellmatic-toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.spellmatic-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.spellmatic-toggle-track {
    display: inline-block;
    width: 40px;
    height: 22px;
    background: #ccc;
    border-radius: 11px;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.spellmatic-toggle-track::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.spellmatic-toggle-input:checked + .spellmatic-toggle-track {
    background: #2E75B6;
}

.spellmatic-toggle-input:checked + .spellmatic-toggle-track::after {
    left: 21px;
}

.spellmatic-toggle-text {
    font-size: 13px;
    color: #444;
}

.spellmatic-digest-next-text {
    font-size: 13px;
    color: #888;
    font-style: italic;
}

.spellmatic-digest-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
/* ── Phase 5: AI badges + result rows ────────────────────────────────────── */

/* AI error type badge — purple tones */
.spellmatic-badge--ai        { background: #F0E6FF; color: #6C3483; }

/* Small "AI" source badge — appears alongside the error-type badge */
.spellmatic-badge--ai-source {
    background: #6C3483;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 2px;
}

/* AI result rows get a very subtle left accent */
.spellmatic-result-row--ai {
    border-left: 3px solid #A569BD;
}

/* Divider between Harper results and AI results */
.spellmatic-ai-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px 0 14px;
    color: #888;
    font-size: 12px;
}

.spellmatic-ai-divider::before,
.spellmatic-ai-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0d0f0;
}

.spellmatic-ai-divider-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    color: #6C3483;
    font-weight: 600;
}

/* ── Results page: fixed-row styling inside grouped cards ─────────────────── */
.spellmatic-result-row--fixed {
    opacity: 0.65;
    background: #f0fdf4;
    border-left: 3px solid #86efac;
}
.spellmatic-result-row--fixed .spellmatic-fix-row {
    gap: 8px;
}
.spellmatic-result-row--dismissed {
    opacity: 0.55;
    background: #f9fafb;
    border-left: 3px solid #d1d5db;
}
.spellmatic-result-row--dismissed:hover {
    opacity: 0.8;
}
.spellmatic-result-row--dismissed .spellmatic-fix-row {
    gap: 8px;
}
.spellmatic-fix-applied {
    color: #16a34a;
    font-weight: 600;
}

/* Inline "Fixed" label shown after applying a fix (next to Undo button) */
.spellmatic-fixed-label {
    color: #16a34a;
    font-weight: 600;
    margin-right: 6px;
}

/* AI group card variant — subtle purple left border */
.spellmatic-post-group--ai {
    border-left: 3px solid #d8b4fe;
}

/* ── Phase 5: BYOK settings table ─────────────────────────────────────────── */

/* Inline status text next to Test Connection button */
.spellmatic-byok-test-status {
    margin-left: 8px;
    font-size: 12px;
    vertical-align: middle;
}

/* Space the Test button away from the key input */
.spellmatic-byok-test-btn {
    margin-left: 6px !important;
    vertical-align: middle;
}

/* ── Phase 5: AI toggle button ────────────────────────────────────────────── */

.spellmatic-ai-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 12px !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
    vertical-align: middle;
    border: 2px solid transparent !important;
    line-height: 1.4 !important;
    height: auto !important;
}

.spellmatic-ai-toggle .ai-toggle-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.18s;
}

.spellmatic-ai-toggle.ai-on {
    background: #e8f5e9 !important;
    border-color: #4caf50 !important;
    color: #2e7d32 !important;
}

.spellmatic-ai-toggle.ai-on .ai-toggle-dot {
    background: #4caf50;
}

.spellmatic-ai-toggle.ai-off {
    background: #f5f5f5 !important;
    border-color: #bdbdbd !important;
    color: #757575 !important;
}

.spellmatic-ai-toggle.ai-off .ai-toggle-dot {
    background: #bdbdbd;
}

.spellmatic-ai-toggle:hover.ai-on {
    background: #c8e6c9 !important;
}

.spellmatic-ai-toggle:hover.ai-off {
    background: #eeeeee !important;
}

/* =========================================================================
   Phase 8 — Scope selector, grouped cards, filter bar, pagination
   ========================================================================= */

/* ── Scope selector ──────────────────────────────────────────────────────── */
.spellmatic-scope-wrap {
    margin-bottom: 12px;
}

.spellmatic-scope-toggle {
    background: none;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #50575e;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}
.spellmatic-scope-toggle:hover {
    background: #f6f7f7;
    color: #1d2327;
}
.spellmatic-scope-toggle .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}
.spellmatic-scope-chevron {
    font-size: 14px;
    transition: transform 0.2s;
    display: inline-block;
}

.spellmatic-scope-panel {
    margin-top: 8px;
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    max-width: 600px;
}
.spellmatic-scope-label {
    font-weight: 600;
    margin: 0 0 10px;
    font-size: 13px;
    color: #1d2327;
}
.spellmatic-scope-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    margin-bottom: 10px;
}
.spellmatic-scope-item {
    font-size: 13px;
    color: #1d2327;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}
.spellmatic-scope-select-all {
    font-size: 12px;
    color: #50575e;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    border-top: 1px solid #f0f0f1;
    padding-top: 8px;
    margin-top: 4px;
}

/* ── Single post search selector ──────────────────────────────────────── */
.spellmatic-single-post-search .spellmatic-scope-label {
    display: flex;
    align-items: center;
    gap: 6px;
}
.spellmatic-post-search-wrap {
    position: relative;
}
#spellmatic-post-search {
    font-size: 13px;
    padding: 6px 10px;
}
.spellmatic-post-search-results {
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #8c8f94;
    border-top: none;
    box-shadow: 0 4px 8px rgba(0,0,0,.12);
}
.spellmatic-post-search-item {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.spellmatic-post-search-item:hover {
    background: #f0f6fc;
}
.spellmatic-post-search-item .spellmatic-pt-badge {
    font-size: 11px;
    color: #787c82;
    background: #f0f0f1;
    padding: 1px 6px;
    border-radius: 3px;
}
.spellmatic-post-search-selected {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #f0f6fc;
    border: 1px solid #2271b1;
    border-radius: 4px;
    font-size: 13px;
}
.spellmatic-post-search-selected .spellmatic-clear-selection {
    margin-left: auto;
    cursor: pointer;
    color: #d63638;
    font-size: 16px;
    line-height: 1;
    background: none;
    border: none;
    padding: 0 2px;
}
.spellmatic-post-search-selected .spellmatic-clear-selection:hover {
    color: #a00;
}

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.spellmatic-filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 0 12px;
    border-bottom: 1px solid #f0f0f1;
    margin-bottom: 12px;
}
.spellmatic-filter-search {
    flex: 1;
    min-width: 160px;
    max-width: 260px;
    font-size: 13px;
    padding: 5px 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    color: #1d2327;
}
.spellmatic-filter-select {
    font-size: 13px;
    padding: 5px 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    color: #1d2327;
    background: #fff;
}

/* ── Post group cards ────────────────────────────────────────────────────── */
.spellmatic-post-group {
    border: 1px solid #dcdcde;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
    background: #fff;
    transition: opacity 0.3s;
}
.spellmatic-post-group.spellmatic-resolved {
    opacity: 0;
}

.spellmatic-post-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f6f7f7;
    border-bottom: 1px solid #dcdcde;
    flex-wrap: wrap;
}
.spellmatic-post-group-header:hover {
    background: #f0f0f1;
}

.spellmatic-group-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    color: #50575e;
    font-size: 12px;
    line-height: 1;
    border-radius: 3px;
    flex-shrink: 0;
}
.spellmatic-group-toggle:hover {
    background: #dcdcde;
}
.spellmatic-toggle-icon {
    font-style: normal;
}

.spellmatic-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: #d7e8f5;
    color: #135e96;
    white-space: nowrap;
    flex-shrink: 0;
}
.spellmatic-type-badge--page     { background: #d7e8f5; color: #135e96; }
.spellmatic-type-badge--post     { background: #e8f5e9; color: #1a6631; }
.spellmatic-type-badge--product  { background: #fce8f5; color: #7a1a5e; }

.spellmatic-group-title {
    font-weight: 600;
    font-size: 14px;
    color: #1d2327;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spellmatic-group-count {
    font-size: 12px;
    color: #d63638;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.spellmatic-post-fix-all-btn {
    font-size: 12px !important;
    padding: 2px 8px !important;
    height: auto !important;
    line-height: 1.6 !important;
    flex-shrink: 0;
}
.spellmatic-post-fix-all-btn.spellmatic-stop-btn {
    background: #d63638 !important;
    border-color: #d63638 !important;
    color: #fff !important;
}

.spellmatic-post-group-body {
    padding: 0;
}
.spellmatic-post-group-body .spellmatic-result-row {
    border-bottom: 1px solid #f0f0f1;
    border-radius: 0;
    margin: 0;
}
.spellmatic-post-group-body .spellmatic-result-row:last-child {
    border-bottom: none;
}

/* Remove post-title from individual rows (it's now in the group header) */
.spellmatic-post-group-body .spellmatic-result-meta {
    gap: 8px;
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.spellmatic-pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    padding: 14px 0 4px;
    flex-wrap: wrap;
}
.spellmatic-page-btn {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
    color: #1d2327;
    transition: background 0.15s;
    min-width: 34px;
    text-align: center;
}
.spellmatic-page-btn:hover:not([disabled]) {
    background: #f0f0f1;
}
.spellmatic-page-btn.is-current {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    font-weight: 600;
}
.spellmatic-page-btn[disabled] {
    opacity: 0.4;
    cursor: default;
}

/* =========================================================================
   Phase 8b — Layout fixes: left-align, sub-nav, plan badge, scan actions
   ========================================================================= */

/* ── Header ───────────────────────────────────────────────────────────── */
.spellmatic-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 4px;
}
.spellmatic-header h1 {
    margin: 0;
    padding: 0;
    line-height: 1.2;
}
.spellmatic-tagline {
    width: 100%;
    margin: 2px 0 12px;
    color: #646970;
    font-size: 13px;
}

/* ── Inline health score bar ──────────────────────────────────────────── */
.spellmatic-health-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 10px 20px;
    margin: 0 0 12px;
}
.spellmatic-health-bar__ring {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
}
.spellmatic-health-bar__pct {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}
.spellmatic-health-bar__label {
    font-weight: 600;
    font-size: 13px;
    min-width: 70px;
}
.spellmatic-health-bar__sep {
    width: 1px;
    height: 28px;
    background: #dcdcde;
    flex-shrink: 0;
}
.spellmatic-health-bar__stat {
    font-size: 13px;
    color: #1e293b;
    white-space: nowrap;
}
.spellmatic-health-bar__stat strong {
    font-size: 15px;
    display: inline;
    margin-right: 2px;
}
.spellmatic-health-bar__stat--fixed strong {
    color: #16a34a;
}
.spellmatic-health-bar__stat--dismissed strong {
    color: #9ca3af;
}
.spellmatic-health-bar__cta {
    margin-left: auto !important;
    white-space: nowrap;
}

/* ── Sub-navigation tabs ──────────────────────────────────────────────── */
.spellmatic-subnav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #dcdcde;
    margin-bottom: 16px;
}
.spellmatic-subnav-link {
    padding: 8px 16px;
    font-size: 13px;
    color: #50575e;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: inline-block;
}
.spellmatic-subnav-link:hover {
    color: #1d2327;
}
.spellmatic-subnav-link.active {
    color: #2271b1;
    border-bottom-color: #2271b1;
    font-weight: 600;
}
/* ── Scan panel: left-align, clean card ──────────────────────────────── */
.spellmatic-scan-panel {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 16px;
    text-align: left;
}

/* Scope wrap: full width, left-aligned */
.spellmatic-scope-wrap {
    margin-bottom: 16px;
    text-align: left;
}
.spellmatic-scope-panel {
    max-width: 100%;
    margin-top: 10px;
    background: #f6f7f7;
}

/* Scan actions row */
.spellmatic-scan-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.spellmatic-scan-btn {
    font-size: 15px !important;
    height: auto !important;
    padding: 10px 22px !important;
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
}

/* ── Results header: title + summary stacked ─────────────────────────── */
.spellmatic-results-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.spellmatic-results-summary {
    font-size: 12px;
    color: #646970;
}
.spellmatic-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #dcdcde;
    background: #fff;
}
.spellmatic-results-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* ── Results container card ──────────────────────────────────────────── */
.spellmatic-results-container {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    overflow: hidden;
}

/* ── Results page toolbar ────────────────────────────────────────────── */
.spellmatic-results-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 0;
    margin-bottom: 4px;
}
.spellmatic-results-toolbar .spellmatic-results-meta {
    font-size: 13px;
    color: #646970;
}
.spellmatic-results-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.spellmatic-results-toolbar-actions .dashicons {
    vertical-align: middle;
    margin-top: -2px;
}
.spellmatic-per-page-label {
    font-size: 13px;
    color: #3c434a;
    display: flex;
    align-items: center;
    gap: 5px;
}
.spellmatic-per-page-label select {
    width: auto !important;
}

/* ── Results page pagination ─────────────────────────────────────────── */
.spellmatic-results-pagination {
    margin-top: 16px;
    text-align: right;
}
.spellmatic-results-pagination .tablenav-pages {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}
.spellmatic-results-pagination .displaying-num {
    font-size: 13px;
    color: #646970;
    margin-right: 8px;
}
.spellmatic-results-pagination .pagination-links {
    display: flex;
    align-items: center;
    gap: 4px;
}
.spellmatic-results-pagination .pagination-links .button {
    min-width: 30px;
    text-align: center;
    padding: 0 6px;
}
.spellmatic-results-pagination .pagination-links .button.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}
.spellmatic-results-pagination .paging-input {
    font-size: 13px;
    padding: 0 6px;
    color: #3c434a;
}

/* ── Results table (full-page version) ───────────────────────────────── */
.spellmatic-results-table {
    margin-top: 0 !important;
    border-top: none !important;
}
.spellmatic-results-table tr.spellmatic-resolved {
    opacity: 0.4;
    transition: opacity 0.3s;
}
