/* 1. The Full-Screen Dimmer */
#rv-portal-modal {
    position: fixed !important;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.8) !important;
    z-index: 9999 !important;
    display: none; /* JS toggles this to 'flex' */
    align-items: center;
    justify-content: center;
}

/* 2. The White Workspace Box */
#rv-portal-modal-content {
    z-index: 10000 !important;
    position: relative !important; /* The Anchor */
    background: #ffffff !important;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    padding: 60px 40px 40px 40px !important; /* Top 60px clears the X button area */
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    overflow-y: auto;
    color: #333;
}

/* Targeted Specificity: Container > Button Class */
div.rv-header-flex-container button.rv-modal-close {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    background-color: #d63638 !important; /* WP Alert Red */
    color: #ffffff !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 20px !important;
    font-weight: bold !important;
    padding: 0 !important;
    line-height: 1 !important;
    transition: background-color 0.2s ease !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* Hover State with High Specificity */
div.rv-header-flex-container button.rv-modal-close:hover {
    background-color: #bc2a2c !important; /* Slightly darker red for feedback */
    color: #ffffff !important;
}
.rv-field-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.rv-input-facade {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f8f8;
    cursor: text;
}

#rv-portal-modal-content label,
#rv-portal-modal-content input,
#rv-portal-modal-content textarea,
#rv-portal-modal-content select {
    color: #000;
}

.rv-btn-physical { background-color: #2271b1 !important; color: white; }
.rv-btn-semantic { background-color: #673ab7 !important; color: white; }
.rv-btn-inventory { background-color: #4caf50 !important; color: white; }

.rv-actions-cell {
    display: flex;
    gap: 4px;
    white-space: nowrap;
    align-items: center;
}

.rv-grid-btn {
    padding: 2px 6px !important;
    font-size: 11px !important;
    height: 24px;
    min-width: 0;
    overflow: hidden;
}

.rv-modal-wrapper { 
    position: relative; 
}

/* Input Box Styling for Modals */

/* Container Alignment & Height Fix */
.rv-pill-container {
    position: relative;
    width: 100%;
    min-height: 40px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    background: #fff;
    display: flex;
    flex-wrap: wrap;
    padding: 4px;
    box-sizing: border-box;
}

.rv-input-overlay {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}


/* The Input Field — ghost (borderless) inside the pill container.
   Applies in both the legacy modal and the new inline panel. */
#rv-portal-modal-content input[type='text'],
#rv-semantic-form-container input[type='text'] {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    flex-grow: 1;
    min-width: 150px;
    height: 32px;
    margin: 0 !important;
    padding: 0 8px !important;
    width: auto !important; /* Overriding the 100% width */
    box-sizing: border-box;
}



.rv-form-row { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    width: 100%; 
    margin-bottom: 15px; 
}

.rv-pill-container { 
    flex-grow: 1; 
}

.rv-add-to-list-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background: #2271b1;
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rv-add-to-list { 
    flex-shrink: 0; 
    white-space: nowrap; 
    height: 40px; 
}

.rv-add-to-list-btn:disabled {
    background: #f0f0f1 !important;
    color: #a7aaad !important;
    border: 1px solid #dcdcde !important;
    cursor: not-allowed;
    opacity: 0.7;
}

.rv-add-to-list-btn:not(:disabled) {
    background: #2271b1 !important;
    color: white !important;
    border: none;
    cursor: pointer;
    opacity: 1;
}

/* Pill styles — .attribute-pill used by legacy modal JS;
   .rv-pill used by PHP renderer and new inline panel JS. */
.attribute-pill,
.rv-pill {
    display: inline-flex;
    align-items: center;
    background-color: #e0e0e0;
    color: #333;
    padding: 4px 12px;
    border-radius: 50px;
    margin: 4px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #ccc;
    cursor: default;
    transition: background-color 0.2s ease;
}

.attribute-pill:hover,
.rv-pill:hover {
    background-color: #d4d4d4;
}

.attribute-pill .remove-pill,
.attribute-pill .rv-remove-pill,
.rv-pill .remove-pill,
.rv-pill .rv-remove-pill {
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
    color: #888;
}

.attribute-pill .remove-pill:hover,
.attribute-pill .rv-remove-pill:hover,
.rv-pill .remove-pill:hover,
.rv-pill .rv-remove-pill:hover {
    color: #d63638; /* WordPress Red */
}

.custom-feature-row input {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 5px;
    width: 100%; /* Or appropriate width for the layout */
    transition: border-color 0.2s ease;
}

.custom-feature-row input:focus {
    border-color: #2271b1; /* WordPress Blue */
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Target inputs inside the modal content and inline panel to break inheritance */
#rv-portal-modal-content input.custom-feature-input,
#rv-semantic-modal input[type='text'].custom-feature-input,
#rv-semantic-form-container input.custom-feature-input {
    /* Force a real border */
    border: 1px solid #8c8f94 !important; 
    
    /* Explicitly set a background to ensure it's not transparent */
    background-color: #ffffff !important;
    
    /* Give it its own shadow to separate it from the parent container shadow */
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1) !important;
    
    /* Standardize dimensions */
    height: 32px !important;
    padding: 0 10px !important;
    margin: 4px 0 !important;
    display: inline-block !important;
}

#rv-portal-modal-content input.custom-feature-input:focus,
#rv-semantic-form-container input.custom-feature-input:focus {
    border-color: #2271b1 !important;
    box-shadow: 0 0 0 1px #2271b1 !important;
}


.custom-feature-row {
    display: flex;
    align-items: center;
}

/* Force the button to match the input height and WordPress branding */
#rv-portal-modal-content .custom-feature-row button,
#rv-portal-modal-content .custom-feature-row .button,
#rv-semantic-form-container .custom-feature-row button,
#rv-semantic-form-container .custom-feature-row .button {
    height: 32px !important;
    line-height: 30px !important; /* Adjust for vertical text centering */
    padding: 0 15px !important;
    margin-left: 5px !important;
    background-color: #2271b1 !important; /* WordPress Blue */
    border: 1px solid #135e96 !important;
    color: #fff !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important; /* Remove theme shadows */
    text-shadow: none !important;
}

#rv-portal-modal-content .custom-feature-row button:hover,
#rv-semantic-form-container .custom-feature-row button:hover {
    background-color: #135e96 !important; /* Darker Blue */
    border-color: #0c4971 !important;
    color: #fff !important;
}

/* 5. Standardized Save Button */
.rv-save-button {
    height: 32px !important;
    padding: 0 15px !important;
    background-color: #2271b1 !important; /* WordPress Blue */
    border: 1px solid #135e96 !important;
    color: #fff !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.rv-save-button:hover:not(:disabled) {
    background-color: #135e96 !important;
    border-color: #0c4971 !important;
}

.rv-save-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    filter: grayscale(1);
}

.rv-save-button.processing {
    background-color: #1e85be !important; /* Lighter blue during processing */
}

.rv-save-button.saved {
    background-color: #4caf50 !important; /* Green for success */
    border-color: #388e3c !important;
}

/* Collapsible Section Styles */
.rv-section-toggle {
    background-color: #f0f0f1;
    border: 1px solid #c3c4c7;
    padding: 8px 12px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    margin-bottom: 5px;
    border-radius: 4px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rv-collapsible-section {
    display: none;
    overflow: hidden;
}

.rv-header-flex-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding-bottom: 10px !important;
    border-bottom: 1px solid #ccc !important;
    margin-bottom: 15px !important;
}

.rv-header-flex-container h2 {
    margin: 0 !important;
}






.rv-portal-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 20px 0 !important;
    font-size: 14px !important; /* Slightly smaller for audit density */
    text-align: left !important;
    background-color: #fff !important;
}

.rv-portal-table th {
    background-color: #f6f7f7 !important; /* WP Gray header */
    color: #1d2327 !important;
    padding: 12px 10px !important;
    border-bottom: 2px solid #dcdcde !important;
    font-weight: 600 !important;
}

.rv-portal-table td {
    padding: 10px !important;
    border-bottom: 1px solid #dcdcde !important;
    vertical-align: middle !important;
}

.rv-portal-table tr:hover {
    background-color: #f0f6fa !important; /* Subtle highlight for audit tracking */
}

/* Standardized Footer Container */
div.rv-modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    padding: 15px 20px !important;
    border-top: 1px solid #dcdcde !important;
    background-color: #f6f7f7 !important;
    margin-top: 15px !important;
}

/* The Sovereign Save Button */
div.rv-modal-footer button.rv-save-button {
    height: 32px !important;
    line-height: 30px !important;
    padding: 0 20px !important;
    background-color: #2271b1 !important; /* WP Blue */
    border: 1px solid #135e96 !important;
    color: #fff !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

div.rv-modal-footer button.rv-save-button:hover {
    background-color: #135e96 !important;
    border-color: #0a4b78 !important;
}

/* Morphing State: Processing */
div.rv-modal-footer button.rv-save-button.is-processing {
    background-color: #a7aaad !important;
    border-color: #8c8f94 !important;
    cursor: not-allowed !important;
    opacity: 0.8 !important;
}

/* Morphing State: Success */
div.rv-modal-footer button.rv-save-button.is-success {
    background-color: #46b450 !important; /* WP Success Green */
    border-color: #317d39 !important;
}

/* Force Font Awesome weights for the portal status icons */
.rv-status-line .fa-solid {
    font-weight: 900 !important;
}

.rv-status-line .fa-regular {
    font-weight: 400 !important;
}

/* Optional: Make them slightly larger for better visibility in the grid */
.rv-status-line i {
    font-size: 14px;
    vertical-align: middle;
}

/* Make the Red Outline Circle appear thicker and more 'Urgent' */
.rv-status-line .fa-regular.fa-circle[style*="firebrick"] {
    font-weight: 900 !important; /* Force a thicker baseline */
    text-shadow: 
        -0.5px -0.5px 0 firebrick,  
         0.5px -0.5px 0 firebrick,
        -0.5px  0.5px 0 firebrick,
         0.5px  0.5px 0 firebrick; /* Simulated thickness */
}

/* Horizontal Pagination Styling */
.rv-pagination-container {
    margin-top: 30px;
}

/* Force Horizontal Row & Kill Bullets */
.rv-pagination-container ul.page-numbers {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    list-style-type: none !important; /* Explicitly kill dots */
    list-style: none !important;      /* Double kill dots */
    padding: 0 !important;
    margin: 20px 0 !important;
}

/* Remove default WordPress padding/bullets from the LI */
.rv-pagination-container ul.page-numbers li {
    list-style-type: none !important;
    list-style: none !important;
    margin: 0 4px 4px 0 !important; /* Space between buttons */
    padding: 0 !important;
}

/* Base style for all pagination items to look like buttons */
.rv-pagination-container ul.page-numbers li a,
.rv-pagination-container ul.page-numbers li span {
    display: block !important; /* Makes the whole box clickable */
    padding: 8px 14px !important;
    min-width: 40px !important;
    text-align: center !important;
    text-decoration: none !important;
    border-radius: 4px !important;
    background-color: #ffffff !important;
    border: 1px solid #ccd0d4 !important;
    color: #2271b1 !important;
    font-size: 13px !important;
    line-height: 1 !important;
    box-shadow: none !important;
}

/* Active Page State - The Filled Blue Box */
.rv-pagination-container ul.page-numbers li span.current {
    background-color: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* Hover state for links */
.rv-pagination-container ul.page-numbers li a:hover {
    background-color: #f6f7f7 !important;
    color: #135e96 !important;
    border-color: #2271b1 !important;
}

/* Clean up the dots between page jumps */
.rv-pagination-container ul.page-numbers li span.dots {
    border: none !important;
    background: none !important;
    color: #64748b !important;
    padding: 8px 5px !important;
}

/* ── Main Layer: Full-Viewport Breakout ─────────────────────────────────────
 *
 * The portal is rendered inside a theme content column that imposes a max-width
 * (e.g. 750px on GeneratePress / Astra single-column layouts).
 *
 * Strategy:
 *   1. width: 100vw   — override the parent's constrained width.
 *   2. margin-left: calc(50% - 50vw)
 *                      — shift left by however much the parent column has
 *                        pushed us in from the viewport edge.  Works for any
 *                        centered layout regardless of the column width.
 *   3. padding: 20px 28px
 *                      — keep content away from the raw screen edges.
 *   4. position: relative + z-index: 100
 *                      — ensures the portal sits above typical sticky headers
 *                        and theme decorations without blowing past modals
 *                        (which use z-index 9999+).
 *   5. box-sizing: border-box on root + * child reset
 *                      — prevents theme stylesheets from inflating widths by
 *                        adding border/padding on top of 100vw.
 *   6. overflow-x: hidden on body.rv-sovereign-portal-active
 *                      — some themes add a horizontal scrollbar when an
 *                        element wider than the content well appears.
 * ─────────────────────────────────────────────────────────────────────────── */

body.rv-sovereign-portal-active {
    overflow-x: hidden;
}

/* ── Portal Page: Theme Container Reset ─────────────────────────────────────
 *
 * The salejunctiontheme wraps every page in:
 *   .content_wrapper > .page-content > .container_24 > .grid_24
 *                     > .fullwidth > .fullwidth_inner
 *
 * PROBLEM: .content_wrapper .page-content has overflow:hidden (both parent
 * theme and child theme).  overflow:hidden on ANY ancestor cuts off the
 * negative-margin breakout technique used by .rv-main-layer, clipping the
 * portal back down to the theme's column width.
 *
 * FIX: When our body class is active, reset every ancestor to overflow:visible
 * and strip the decorative chrome from .fullwidth_inner so the breakout
 * on .rv-main-layer can reach the full viewport edge.
 * ─────────────────────────────────────────────────────────────────────────── */
body.rv-sovereign-portal-active .content_wrapper .page-content {
    overflow: visible !important;
    background: transparent !important;
    border: none !important;
    padding-bottom: 0 !important;
    min-height: 0 !important;
}

body.rv-sovereign-portal-active .fullwidth .fullwidth_inner {
    border: none !important;
    padding: 0 !important;
    margin-top: 0 !important;
    background: transparent !important;
}

/* ── Main Layer: Portal Navigation ─────────────────────────────── */
/* NOTE: width and margin-left are set by rv_portal_breakout() in main-layer.php
 * using exact getBoundingClientRect pixel values.  Do NOT add width/margin-left
 * here — CSS !important would override the JS inline styles and break the breakout. */
.rv-main-layer {
    /* Flex host: sidebar left, content right */
    display: flex !important;
    align-items: stretch !important;
    min-height: 100vh !important;

    /* Sit above theme decorations; below modals (9999+) */
    position: relative !important;
    z-index: 100 !important;

    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f0f2f5;
}

/* Box-sizing reset — prevents theme padding from inflating 100vw */
.rv-main-layer *,
.rv-main-layer *::before,
.rv-main-layer *::after {
    box-sizing: border-box !important;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.rv-portal-sidebar {
    display: flex !important;
    flex-direction: column !important;
    flex-shrink: 0 !important;
    width: 240px !important;
    background: #001a33 !important;
    padding: 28px 0 20px 0 !important;
    position: sticky !important;
    top: 32px !important;  /* clear the WP admin bar */
    height: calc(100vh - 32px) !important;
    overflow: visible !important;  /* visible allows fly-out submenus to escape; nav scrolls via .rv-portal-sidebar-nav */
}

.rv-portal-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.rv-portal-sidebar-nav::-webkit-scrollbar-track {
    background: #001a33;
}
.rv-portal-sidebar-nav::-webkit-scrollbar-thumb {
    background: #1e3a5f;
    border-radius: 2px;
}

/* Sidebar logo / wordmark slot */
.rv-portal-sidebar-nav {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    overflow-y: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: #1e3a5f #001a33 !important;
}

/* ── Group Dividers ─────────────────────────────────────────────── */
.rv-sidebar-group {
    margin-top: 20px !important;
    padding: 0 0 6px 0 !important;
    border-top: 1px solid rgba(255,255,255,0.06) !important;
    padding-top: 12px !important;
}

.rv-sidebar-group:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
}

.rv-sidebar-group-label {
    display: block !important;
    padding: 0 20px 6px 20px !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    color: #5a7a99 !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
}

.rv-sidebar-group-label em {
    display: block !important;
    font-style: normal !important;
    font-weight: 400 !important;
    font-size: 0.65rem !important;
    letter-spacing: 0.04em !important;
    color: #3d5a73 !important;
    text-transform: none !important;
    margin-top: 1px !important;
}

/* ── Sidebar Items ──────────────────────────────────────────────── */
.rv-sidebar-item {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    padding: 7px 20px 7px 20px !important;
    background: transparent !important;
    border: none !important;
    border-left: 3px solid transparent !important;
    color: #a8bfd4 !important;
    font-family: inherit !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em !important;
    text-align: left !important;
    cursor: pointer !important;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease !important;
    outline: none !important;
    white-space: nowrap !important;
    line-height: 1.35 !important;
}

.rv-sidebar-item:hover {
    background: rgba(255,255,255,0.06) !important;
    color: #e2edf7 !important;
    border-left-color: rgba(40,167,69,0.4) !important;
}

.rv-sidebar-item.active {
    background: rgba(40,167,69,0.12) !important;
    color: #ffffff !important;
    border-left-color: #28a745 !important;
    font-weight: 600 !important;
}

.rv-sidebar-item.active:hover {
    background: rgba(40,167,69,0.18) !important;
}

/* ── Nav Item Group (collapsible submenu) ───────────────────────── */
/* ── Nav Item Group (fly-out submenu) ───────────────────────────── */
.rv-nav-item-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    position: relative !important;  /* anchor for the fly-out */
}

.rv-nav-group-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 7px 20px 7px 20px !important;
    background: transparent !important;
    border: none !important;
    border-left: 3px solid transparent !important;
    color: #a8bfd4 !important;
    font-family: inherit !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em !important;
    text-align: left !important;
    cursor: pointer !important;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease !important;
    outline: none !important;
    white-space: nowrap !important;
    line-height: 1.35 !important;
}

.rv-nav-group-toggle:hover {
    background: rgba(255,255,255,0.06) !important;
    color: #e2edf7 !important;
    border-left-color: rgba(40,167,69,0.4) !important;
}

/* Toggle highlight when fly-out is open */
.rv-nav-item-group.open > .rv-nav-group-toggle {
    background: rgba(40,167,69,0.10) !important;
    color: #e2edf7 !important;
    border-left-color: #28a745 !important;
}

/* Parent stays highlighted when a child item is the active route */
.rv-nav-item-group.has-active-child > .rv-nav-group-toggle {
    background: rgba(40,167,69,0.10) !important;
    color: #ffffff !important;
    border-left-color: #28a745 !important;
    font-weight: 600 !important;
}

/* ── Chevron ─────────────────────────────────────────────────────── */
.rv-nav-group-chevron {
    flex-shrink: 0 !important;
    opacity: 0.55 !important;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                opacity  0.22s ease !important;
}

.rv-nav-item-group.open > .rv-nav-group-toggle .rv-nav-group-chevron {
    transform: rotate(90deg) !important;
    opacity: 1 !important;
}

/* ── Fly-out Submenu ─────────────────────────────────────────────── */
.rv-nav-submenu {
    position: fixed !important;      /* fixed escapes overflow-y:auto on .rv-portal-sidebar-nav */
    top: 0 !important;               /* overridden inline by JS on open */
    left: 0 !important;              /* overridden inline by JS on open */
    z-index: 99999 !important;
    min-width: 200px !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 8px 0 !important;
    background: #012a50 !important;
    border: 1px solid rgba(40,167,69,0.28) !important;
    border-left: 3px solid #28a745 !important;
    border-radius: 0 6px 6px 0 !important;
    box-shadow:
        4px 8px 28px rgba(0, 0, 0, 0.50),
        0   0   0 1px rgba(255,255,255,0.04) !important;
    /* Animate in: hidden by default -------------------------------- */
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateX(-8px) !important;
    transition:
        opacity    0.18s ease,
        transform  0.18s ease,
        visibility 0s   linear 0.18s !important;  /* delay hides after fade */
    pointer-events: none !important;
}

/* Open state: slide in + fade */
.rv-nav-item-group.open > .rv-nav-submenu {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    transition:
        opacity    0.18s ease,
        transform  0.18s ease,
        visibility 0s   linear 0s !important;     /* no delay on show */
    pointer-events: auto !important;
}

/* ── Submenu Items ───────────────────────────────────────────────── */
.rv-nav-submenu-item {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    padding: 8px 20px 8px 18px !important;
    background: transparent !important;
    border: none !important;
    border-left: 3px solid transparent !important;
    color: #8aafc8 !important;
    font-family: inherit !important;
    font-size: 0.83rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.01em !important;
    text-align: left !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease !important;
    outline: none !important;
}

.rv-nav-submenu-item:hover {
    background: rgba(255,255,255,0.07) !important;
    color: #e2edf7 !important;
    border-left-color: rgba(40,167,69,0.45) !important;
}

.rv-nav-submenu-item.active {
    background: rgba(40,167,69,0.14) !important;
    color: #ffffff !important;
    border-left-color: #28a745 !important;
    font-weight: 600 !important;
}

/* ── Sidebar Footer (Settings) ──────────────────────────────────── */
.rv-sidebar-footer {
    margin-top: auto !important;
    padding: 16px 0 0 0 !important;
    border-top: 1px solid rgba(255,255,255,0.08) !important;
}

.rv-sidebar-settings {
    gap: 10px !important;
    color: #6b8faa !important;
}

.rv-sidebar-settings:hover {
    color: #a8bfd4 !important;
}

.rv-sidebar-settings-icon {
    flex-shrink: 0 !important;
    opacity: 0.7 !important;
    transition: transform 0.4s ease, opacity 0.15s ease !important;
}

.rv-sidebar-settings:hover .rv-sidebar-settings-icon {
    transform: rotate(45deg) !important;
    opacity: 1 !important;
}

/* ── Content Area ───────────────────────────────────────────────── */
.rv-portal-content {
    flex: 1 !important;
    min-width: 0 !important;  /* prevent flex blowout */
    padding: 40px !important;
    background: #f0f2f5 !important;
    overflow-x: hidden !important;
}

/* ── Legacy Nav Pills (kept for onboarding box + other uses) ────── */
.rv-portal-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0 18px 0;
    align-items: center;
    justify-content: flex-start;
}

.rv-nav-pill {
    flex-shrink: 0;
    padding: 7px 22px;
    border-radius: 30px;
    border: 2px solid #d1d5db;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
    outline: none;
    white-space: nowrap;
}

.rv-nav-pill:hover {
    border-color: #9ca3af;
    color: #374151;
}

.rv-nav-pill.active {
    background: #1a1a2e;
    color: #ffffff;
    border-color: #1a1a2e;
}

.rv-nav-pill.active:hover {
    background: #2d2d4e;
    border-color: #2d2d4e;
}

/* ── Layer Panels ───────────────────────────────────────────────── */
.rv-layer {
    display: none;
}

.rv-layer.active {
    display: block;
    animation: rv-layer-fadein 0.22s ease;
}

@keyframes rv-layer-fadein {
    from {
        opacity: 0;
        transform: translateY( 6px );
    }
    to {
        opacity: 1;
        transform: translateY( 0 );
    }
}

/* ── Responsive: collapse sidebar on tablet/mobile ──────────────── */
@media (max-width: 899px) {
    .rv-main-layer {
        flex-direction: column !important;
    }

    .rv-portal-sidebar {
        width: 100% !important;
        height: auto !important;
        position: static !important;
        padding: 16px 0 8px 0 !important;
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
    }

    .rv-portal-sidebar-nav {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 0 !important;
        overflow-x: auto !important;
    }

    .rv-sidebar-group {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        border-top: none !important;
        border-left: 1px solid rgba(255,255,255,0.06) !important;
        padding: 0 8px !important;
    }

    .rv-sidebar-group:first-child {
        border-left: none !important;
    }

    .rv-sidebar-group-label {
        display: none !important;
    }

    .rv-sidebar-item {
        white-space: nowrap !important;
        padding: 8px 14px !important;
        border-left: none !important;
        border-bottom: 3px solid transparent !important;
        font-size: 0.82rem !important;
    }

    .rv-sidebar-item.active {
        border-bottom-color: #28a745 !important;
        border-left-color: transparent !important;
    }

    .rv-sidebar-item:hover {
        border-left-color: transparent !important;
        border-bottom-color: rgba(40,167,69,0.4) !important;
    }

    .rv-sidebar-footer {
        margin-top: 0 !important;
        padding: 0 8px !important;
        border-top: none !important;
        border-left: 1px solid rgba(255,255,255,0.08) !important;
        display: flex !important;
        align-items: center !important;
    }

    .rv-portal-content {
        padding: 24px 16px !important;
    }
}

/* ── Category Batch Editor ─────────────────────────────────────── */
.rv-category-batch-editor {
    max-width: 900px;
}

.rv-catalog-row {
    margin-bottom: 25px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.rv-catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.rv-catalog-label {
    font-size: 1.1em;
    font-weight: 700;
}

.rv-catalog-count {
    font-weight: 400;
    color: #6b7280;
    font-size: 0.9em;
    margin-left: 4px;
}

/* ── AI Wand Button ────────────────────────────────────────────────────── */
.rv-ai-generate {
    background: none;
    border: none;
    padding: 2px 4px;
    line-height: 1;
    cursor: pointer;
}

.rv-ai-wand {
    display: inline-block;
    color: #777;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
}

.rv-ai-wand:hover {
    color: #2271b1;
    transform: scale(1.1);
}

@keyframes rv-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.rv-ai-wand.loading {
    animation: rv-spin 0.8s linear infinite;
    color: #2271b1;
}

.rv-catalog-editor textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.rv-catalog-editor textarea:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.rv-word-count-status {
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.rv-wc-red    { color: #dc2626; }
.rv-wc-yellow { color: #ca8a04; }
.rv-wc-green  { color: #16a34a; }

.rv-category-batch-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid #e5e5e5;
}

.rv-save-status {
    font-size: 0.9em;
    font-weight: 600;
}

/* ── Settings Layer ─────────────────────────────────────────────── */
.rv-settings-layer {
    max-width: 700px;
    padding: 10px 0;
}

.rv-settings-group {
    margin-bottom: 24px;
}

.rv-settings-label {
    display: block;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    color: #374151;
}

.rv-settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rv-settings-input {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.rv-settings-input:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.rv-settings-input--api-key {
    min-width: 400px;
    flex: 1;
}

.rv-settings-input--sa-json {
    width: 100%;
    min-height: 90px;
    font-family: monospace;
    font-size: 12px;
    resize: vertical;
    box-sizing: border-box;
}

.rv-settings-label--sub {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-top: 16px;
    display: block;
}

.rv-settings-row--actions {
    margin-top: 12px;
    gap: 12px;
}

/* ── Settings: Instructions Banner ─────────────────────────────── */
.rv-sovereign-instructions {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
    color: #0c4a6e;
}

.rv-sovereign-instructions p {
    margin: 0 0 12px 0;
}

.rv-sovereign-instructions a {
    color: #0369a1;
}

.rv-btn-get-key {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 30px;
    background: #ffffff;
    color: #0369a1;
    border: 2px solid #0369a1;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
}

.rv-btn-get-key:hover {
    background: #075985;
    color: #ffffff;
}
/* Ensure the Get Key button is always visible */
.rv-onboarding-box .rv-nav-pill.active {
    background-color: #000 !important; /* Force solid background */
    color: #fff !important;           /* Force white text */
    display: inline-block;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 30px;
    margin-top: 10px;
    transition: opacity 0.2s ease;
}

.rv-onboarding-box .rv-nav-pill.active:hover {
    opacity: 0.8;
}

/* The Wand Icon */
.rv-ai-wand {
    display: inline-block !important;
    visibility: visible !important;
    width: 20px !important;
    height: 20px !important;
    line-height: 20px !important;
    opacity: 1 !important;
}

.rv-ai-wand:hover {
    color: #2271b1; /* WordPress Blue */
    transform: scale(1.2) rotate(15deg);
}

/* The Spinning Animation for Loading State */
.rv-ai-wand.loading {
    color: #f39c12; /* Golden/Amber */
    animation: rv-spin 1.5s linear infinite;
    pointer-events: none; /* Prevent double-clicks */
}

@keyframes rv-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Page Layer ─────────────────────────────────────────────────── */

.rv-page-layer-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ── Sovereign header bar ─────────────────────────────────── */
/* ── Shared layer header (rv_render_layer_header) ─────────────── */
.rv-layer-header {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 24px;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d3a5e 60%, #3b5a8a 100%);
    border-radius: 8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(26, 26, 46, 0.18), inset 0 1px 0 rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.rv-layer-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #e8eaf0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* Layer header variant with an action button on the right */
.rv-layer-header--flex {
    justify-content: space-between;
}

/* Subtext line immediately below a layer header */
.rv-layer-subtext {
    font-size: 13px;
    color: #6b7280;
    margin: -8px 0 24px;
    line-height: 1.6;
}

/* Legacy aliases — kept for any markup that still emits the old class names */
.rv-page-layer-container .rv-page-layer-header {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 24px;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d3a5e 60%, #3b5a8a 100%);
    border-radius: 8px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(26, 26, 46, 0.18), inset 0 1px 0 rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.rv-page-layer-container .rv-page-layer-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #e8eaf0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* ── Tier section ─────────────────────────────────────────── */
.rv-page-tier-section {
    margin-bottom: 24px;
}

.rv-page-tier-bar {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 20px;
    border-radius: 7px 7px 0 0;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255,255,255,0.07);
}

.rv-page-tier-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #e8eaf0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
}

/* Right-side group: insight icon + page count — pushed to far right */
.rv-page-tier-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Right-side group: insight icon + page count — pushed to far right */
.rv-page-tier-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* .rv-page-tier-consult-btn — all styling now via .rv-consulting-btn canonical class */
/* Only tier-specific overrides remain here */
.rv-page-tier-consult-btn {
    font-size: 11px !important;
    height: 24px !important;
    padding: 0 9px !important;
}

.rv-page-tier-count {
    font-size: 11px;
    font-weight: 500;
    color: rgba(232, 234, 240, 0.65);
    letter-spacing: 0.03em;
}

/* ── Tile grid → vertical stack ──────────────────────────────── */
.rv-page-tile-stack {
    display: flex;
    flex-direction: column;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 7px 7px;
}

.rv-page-tier-empty {
    margin: 0;
    padding: 14px 18px;
    font-size: 12px;
    font-style: italic;
    color: #9ca3af;
}

/* -- Individual tile (column container: header bar + working area) -- */
.rv-page-tile {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-bottom: 1px solid #e9eaec;
    overflow: hidden; /* clips working area to the tile's border-radius */
}

.rv-page-tile:last-child {
    border-bottom: none;
    border-radius: 0 0 7px 7px;
}

/* Visible strip bar */
.rv-page-tile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 11px 18px;
    cursor: default;
    transition: background 0.14s ease, box-shadow 0.14s ease;
}

.rv-page-tile:hover > .rv-page-tile-header {
    background: #f0f4ff;
    box-shadow: inset 3px 0 0 #3b5a8a;
}

/* Left block: two-row column */
.rv-page-tile-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

/* Row 1: title + draft badge + date (left), status buttons + chevron (right) */
.rv-page-header-row-1 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.rv-page-tile-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

.rv-page-tile-title {
    font-size: 13px;
    font-weight: 700;
    color: #1d2327;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    flex-shrink: 1;
    min-width: 30px;
}

.rv-badge-draft {
    display: inline-block;
    background: #e0e0e0;
    color: #666666;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 12px;
    vertical-align: middle;
    margin-left: 0;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Sovereign Tier badges on category tiles ───────────────────────────── */
.rv-sovereign-tier-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 12px;
    vertical-align: middle;
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}
.rv-tier-primary   { background: #d1fae5; color: #065f46; }
.rv-tier-secondary { background: #dbeafe; color: #1e40af; }
.rv-tier-other     { background: #f3f4f6; color: #6b7280; }

.rv-page-tile-modified {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Row 2: slug · view · edit (inline left) | chevron (far right) */
.rv-page-header-row-2 {
    display: flex;
    align-items: center;
    margin-top: 8px;
    gap: 10px;
    min-width: 0;
}

.rv-page-tile-slug {
    font-size: 11px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: none;
    padding: 0;
    border-radius: 0;
    border: none;
    flex: 0 1 auto;
    min-width: 0;
}

.rv-page-tile-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Chevron pushed to far right */
.rv-page-header-row-2 .rv-page-tile-chevron {
    margin-left: auto;
    flex-shrink: 0;
}

.rv-page-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    padding: 4px 12px;
    border-radius: 5px;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
                box-shadow 0.15s ease;
}

.rv-page-action-btn--view {
    background: #f8fafc;
    color: #374151;
    border: 1px solid #d1d5db;
}
.rv-page-action-btn--view:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.12);
    text-decoration: none;
}

.rv-page-action-btn--edit {
    background: #f8fafc;
    color: #374151;
    border: 1px solid #d1d5db;
}
.rv-page-action-btn--edit:hover {
    background: #f0fdf4;
    border-color: #86efac;
    color: #15803d;
    box-shadow: 0 1px 3px rgba(34, 197, 94, 0.12);
    text-decoration: none;
}

/* When used as icon-only buttons, reset text-button padding/border */
.rv-page-action-btn.rv-icon-btn {
    padding: 8px;
    border: none;
    background: transparent;
    gap: 0;
}
.rv-page-action-btn--view.rv-icon-btn:hover {
    background-color: #1d4ed8;
    color: rgba(var(--rv-bg-rgb), 0.9);
    box-shadow: none;
    border: none;
}
.rv-page-action-btn--edit.rv-icon-btn:hover {
    background-color: #15803d;
    color: rgba(var(--rv-bg-rgb), 0.9);
    box-shadow: none;
    border: none;
}
.rv-page-tile-status {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Chevron expand/collapse button */
.rv-page-tile-chevron {
    background: none;
    border: none;
    padding: 2px 4px;
    margin: 0;
    cursor: pointer;
    color: #9ca3af;
    font-size: 11px;
    line-height: 1;
    border-radius: 3px;
    transition: color 0.13s ease;
}

.rv-page-tile-chevron:hover {
    color: #374151;
}

.rv-page-tile-chevron i {
    display: inline-block;
    transition: transform 0.2s ease;
}

.rv-page-tile-chevron.is-open i {
    transform: rotate(180deg);
}

/* Visibility toggle */
.rv-page-tile-visibility {
    background: none;
    border: none;
    padding: 2px 4px;
    margin: 0;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    border-radius: 3px;
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.rv-page-tile-visibility:hover {
    transform: scale(1.15);
}

.rv-visibility--index {
    color: #2563eb;
    opacity: 0.8;
}

.rv-visibility--index:hover {
    opacity: 1;
}

.rv-visibility--noindex {
    color: #9ca3af;
    opacity: 0.65;
}

.rv-visibility--noindex:hover {
    opacity: 0.9;
}

/* -- Trash / Dependency-Check Button --------------------------------------- */
.rv-page-tile-trash {
    background: none;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    color: #9ca3af;
    border-radius: 3px;
    transition: color 0.15s ease, transform 0.1s ease;
}

.rv-page-tile-trash:hover {
    color: #dc2626;
    transform: scale(1.15);
}

.rv-page-tile-trash--loading {
    color: #f59e0b;
    pointer-events: none;
}

/* -- Deletion Modal --------------------------------------------------------- */
.rv-deletion-overlay {
    position: fixed;
    inset: 0;
    z-index: 100200;
    background: rgba(0,0,0,.72);
    display: flex;
    align-items: center;
    justify-content: center;
}
.rv-deletion-modal {
    background: #1a2236;
    border: 1px solid #2e3f5e;
    border-radius: 12px;
    width: 480px;
    max-width: calc(100vw - 40px);
    box-shadow: 0 24px 60px rgba(0,0,0,.55);
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow: hidden;
}
.rv-dm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #2e3f5e;
}
.rv-dm-icon {
    font-size: 22px;
    color: #f59e0b;
    flex-shrink: 0;
}
.rv-dm-title {
    font-size: 16px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}
.rv-dm-body {
    padding: 18px 24px;
}
.rv-dm-message {
    font-size: 14px;
    line-height: 1.55;
    color: #cbd5e1;
    margin: 0 0 10px;
}
.rv-dm-link-list {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #2e3f5e;
    border-radius: 6px;
    background: #111827;
}
.rv-dm-link-list li {
    padding: 8px 14px;
    border-bottom: 1px solid #1f2d44;
    font-size: 13px;
}
.rv-dm-link-list li:last-child { border-bottom: none; }
.rv-dm-link-list a {
    color: #93c5fd;
    text-decoration: none;
}
.rv-dm-link-list a:hover { text-decoration: underline; }
.rv-dm-overflow {
    color: #64748b !important;
    font-style: italic;
}
.rv-dm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px 20px;
    border-top: 1px solid #2e3f5e;
}
.rv-dm-btn {
    border: none;
    border-radius: 6px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: opacity .15s;
}
.rv-dm-btn:disabled { opacity: .45; cursor: not-allowed; }
.rv-dm-btn--danger {
    background: #dc2626;
    color: #fff;
}
.rv-dm-btn--danger:hover:not(:disabled) { opacity: .85; }
.rv-dm-btn--fix {
    background: #2563eb;
    color: #fff;
}
.rv-dm-btn--fix:hover:not(:disabled) { opacity: .85; }
.rv-dm-btn--secondary {
    background: #2e3f5e;
    color: #cbd5e1;
}
.rv-dm-btn--secondary:hover { background: #3a506e; }

/* -- Action Stack (3-option vertical layout) -------------------------------- */
@keyframes rv-dm-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(91,33,182,.55), 0 0 0 0 rgba(245,158,11,.35); }
    50%  { box-shadow: 0 0 0 6px rgba(91,33,182,.0), 0 0 12px 4px rgba(245,158,11,.25); }
    100% { box-shadow: 0 0 0 0 rgba(91,33,182,.55), 0 0 0 0 rgba(245,158,11,.35); }
}
.rv-dm-action-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 24px 20px;
    border-top: 1px solid #2e3f5e;
}
.rv-dm-option {
    display: block;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s, background .15s, border-color .15s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.rv-dm-option:hover:not(:disabled) { transform: scale(1.02); box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.rv-dm-option:disabled { opacity: .45; cursor: not-allowed; }
.rv-dm-option--recommended {
    background: linear-gradient(135deg, #5b21b6 0%, #2563eb 100%);
    border: 2px solid rgba(245,158,11,.55);
    padding: 14px 18px;
    color: #fff;
    font-weight: 600;
    animation: rv-dm-pulse 2.4s ease-in-out infinite;
}
.rv-dm-option--recommended:hover:not(:disabled) { opacity: .92; animation-play-state: paused; }
.rv-dm-option-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.rv-dm-option-label {
    font-size: 14px;
    font-weight: 700;
}
.rv-dm-badge {
    background: rgba(255,255,255,.22);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    border-radius: 20px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.rv-dm-badge-recommended {
    background: #f59e0b;
    color: #1a1a2e;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 2px 7px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}
.rv-dm-option-desc {
    font-size: 12px;
    color: rgba(255,255,255,.72);
    margin: 0;
    line-height: 1.45;
}
.rv-dm-option--secondary {
    background: transparent;
    border: 1px solid #4a5568;
    padding: 12px 18px;
    color: #e2e8f0;
}
.rv-dm-option--secondary:hover:not(:disabled) { background: #2e3f5e; border-color: #5a6a82; }
.rv-dm-option--secondary .rv-dm-option-desc { color: #94a3b8; }
.rv-dm-option--cancel {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 13px;
    font-weight: 500;
    padding: 8px;
    text-align: center;
    width: 100%;
}
.rv-dm-option--cancel:hover { color: #94a3b8; transform: none; box-shadow: none; }

/* ── Sovereign Warning Modal ─────────────────────────────────────────────── */
.rv-sw-overlay {
    position: fixed;
    inset: 0;
    z-index: 100300;
    background: rgba(0,0,0,.78);
    display: flex;
    align-items: center;
    justify-content: center;
}
.rv-sw-modal {
    background: #1a1a2e;
    border: 1px solid #c2410c;
    border-radius: 12px;
    width: 560px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(239,68,68,.2), 0 24px 60px rgba(0,0,0,.65);
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow: hidden;
}
.rv-sw-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(194,65,12,.35);
    background: rgba(239,68,68,.07);
    flex-shrink: 0;
}
.rv-sw-icon {
    font-size: 28px;
    color: #ef4444;
    flex-shrink: 0;
    margin-top: 2px;
}
.rv-sw-title {
    font-size: 17px;
    font-weight: 700;
    color: #fca5a5;
    margin: 0 0 3px;
    letter-spacing: .01em;
}
.rv-sw-subtitle {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #f87171;
    margin: 0;
    opacity: .75;
}
.rv-sw-body {
    padding: 18px 24px 14px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}
.rv-sw-message {
    font-size: 14px;
    line-height: 1.6;
    color: #cbd5e1;
    margin: 0 0 14px;
}

/* -- Two-column dependency table -- */
.rv-sw-dep-table-wrap {
    border: 1px solid #2e3f5e;
    border-radius: 7px;
    overflow: hidden;
}
.rv-sw-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.rv-sw-th {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #93c5fd;
    padding: 7px 10px 7px 12px;
    text-align: left;
    background: rgba(30,58,92,.65);
    border-bottom: 1px solid #2e3f5e;
}
.rv-sw-th-source { width: 28%; }
.rv-sw-th-data   { width: 72%; }
.rv-sw-tr {
    border-bottom: 1px solid #1f2d44;
}
.rv-sw-tr:last-child { border-bottom: none; }
.rv-sw-tr:nth-child(even) { background: rgba(255,255,255,.025); }
.rv-sw-td {
    padding: 7px 10px 7px 12px;
    vertical-align: middle;
    font-size: 12px;
}
.rv-sw-td-source {
    display: table-cell;
    white-space: nowrap;
}
.rv-sw-src-icon {
    font-size: 13px;
    width: 13px;
    height: 13px;
    vertical-align: middle;
    color: #f59e0b;
    margin-right: 5px;
    position: relative;
    top: -1px;
}
.rv-sw-src-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #94a3b8;
    vertical-align: middle;
}
.rv-sw-td-data {
    display: table-cell;
}
.rv-sw-data-name {
    display: block;
    font-size: 12px;
    color: #e2e8f0;
    line-height: 1.4;
    margin-bottom: 2px;
}
.rv-sw-data-link {
    font-size: 10px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    color: #60a5fa;
    text-decoration: none;
    letter-spacing: .02em;
    border-radius: 3px;
    padding: 1px 4px;
    transition: background .15s ease, color .15s ease;
    display: inline-block;
}
.rv-sw-data-link:hover {
    background: rgba(96,165,250,.15);
    color: #93c5fd;
    text-decoration: none;
}
.rv-sw-overflow {
    color: #64748b;
    font-style: italic;
    font-size: 11px;
    padding: 6px 12px;
    text-align: center;
    background: rgba(30,58,92,.3);
}

/* -- Footer: recommendation + action stack -- */
.rv-sw-footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(194,65,12,.3);
}
.rv-sw-recommendation {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 24px 10px;
    background: rgba(5,150,105,.08);
    border-bottom: 1px solid rgba(5,150,105,.2);
}
.rv-sw-rec-star {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #34d399;
    flex-shrink: 0;
    margin-top: 2px;
}
.rv-sw-rec-copy {
    font-size: 12px;
    line-height: 1.55;
    color: #a7f3d0;
    margin: 0;
}
.rv-sw-rec-copy strong {
    color: #6ee7b7;
    font-weight: 700;
}
.rv-sw-action-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 24px 18px;
}
.rv-sw-option {
    display: block;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.rv-sw-option:hover:not(:disabled) { transform: scale(1.015); box-shadow: 0 4px 16px rgba(0,0,0,.35); }
.rv-sw-option:disabled { opacity: .45; cursor: not-allowed; }
.rv-sw-option-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.rv-sw-option-label {
    font-size: 14px;
    font-weight: 700;
}
.rv-sw-option-desc {
    font-size: 12px;
    color: rgba(255,255,255,.65);
    margin: 0;
    line-height: 1.45;
}

/* Recommended: "No, Cancel and Fix" — primary green glow */
.rv-sw-option--safe {
    background: linear-gradient(135deg, #065f46 0%, #047857 100%);
    border: 2px solid rgba(52,211,153,.45);
    padding: 14px 18px;
    color: #fff;
    font-weight: 600;
    animation: rv-sw-pulse 2.4s ease-in-out infinite;
}
.rv-sw-option--safe:hover:not(:disabled) { opacity: .92; animation-play-state: paused; }
@keyframes rv-sw-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,.25); }
    50%       { box-shadow: 0 0 0 6px rgba(52,211,153,.0); }
}
.rv-sw-badge {
    background: rgba(255,255,255,.22);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .6px;
    border-radius: 20px;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
}
.rv-sw-badge--recommended {
    background: #f59e0b;
    color: #1a1a2e;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-radius: 3px;
}

/* Secondary: "Yes, Proceed Anyway" — muted destructive */
.rv-sw-option--proceed {
    background: transparent;
    border: 1px solid #4a3030;
    padding: 12px 18px;
    color: #fca5a5;
}
.rv-sw-option--proceed:hover:not(:disabled) {
    background: rgba(239,68,68,.08);
    border-color: #c2410c;
}

/* -- Expandable Working Area ------------------------------------------------ */
.rv-page-working-area {
    border-top: 1px solid #e9eaec;
    background: #f8f9fb;
    padding: 16px 18px 18px 50px; /* left indent aligns with tile content past handle */
}

.rv-pwa-inner {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Row 1: 50/50 two-column split */
.rv-pwa-split {
    display: flex;
    gap: 20px;
}

.rv-pwa-audit,
.rv-pwa-meta-editor {
    flex: 1;
    min-width: 0;
}

.rv-pwa-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
}

/* Audit items */
.rv-pwa-audit-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 12px;
    color: #374151;
    border-bottom: 1px solid #f0f0f0;
}

.rv-pwa-audit-item:last-child {
    border-bottom: none;
}

.rv-pwa-audit-value {
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
}

/* Save Meta Changes button + last-saved label */
.rv-pwa-save-meta-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
}

.rv-pwa-save-meta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    background: #1d3461;
    border: 1px solid #162849;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.14s ease, opacity 0.14s ease;
    white-space: nowrap;
}

.rv-pwa-save-meta-btn:hover {
    background: #253f78;
}

.rv-pwa-save-meta-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.rv-pwa-save-meta-btn.rv-save-success {
    background: #15803d;
    border-color: #14532d;
}

.rv-meta-last-saved {
    font-size: 10px;
    color: #9ca3af;
    font-style: italic;
}

/* ── Alt-Text Editor Modal ─────────────────────────────────────────────── */
#rv-alt-editor-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

#rv-alt-editor-modal {
    background: #ffffff;
    border-radius: 8px;
    width: min(860px, 92vw);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

#rv-alt-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #1d3461;
    color: #ffffff;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
}

#rv-alt-editor-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.02em;
}

#rv-close-alt-modal {
    background: #dc2626;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.14s ease;
}

#rv-close-alt-modal:hover {
    background: #b91c1c;
}

#rv-trigger-alt-editor {
    margin-top: 6px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    background: #1d3461;
    border: 1px solid #162849;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.14s ease;
}

#rv-trigger-alt-editor:hover {
    background: #2a4a8a;
}

#rv-alt-tile-container {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1 1 auto;
    font-size: 13px;
    color: #374151;
}

.rv-alt-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #e5e7eb;
}

.rv-alt-tile:last-child {
    border-bottom: none;
}

.rv-alt-tile--missing .rv-alt-tile-thumb img {
    outline: 2px solid #dc2626;
    border-radius: 4px;
}

.rv-alt-tile-thumb {
    flex-shrink: 0;
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rv-alt-tile-thumb img {
    max-width: 80px;
    height: auto;
    border-radius: 4px;
    display: block;
}

.rv-alt-tile-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rv-alt-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    resize: vertical;
    color: #111827;
    background: #f9fafb;
    transition: border-color 0.14s ease;
}

.rv-alt-input:focus {
    outline: none;
    border-color: #1d3461;
    background: #ffffff;
}

/* Input group — wraps header row + textarea */
.rv-alt-input-group {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Header row: label left, counter right — mirrors .rv-pwa-field-header */
.rv-alt-input-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
    padding: 0 2px;
}

.rv-alt-input-label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

.rv-alt-textarea-wrap {
    position: relative;
    padding-top: 16px; /* headroom for the sparkle button sitting on the top edge */
}

.rv-alt-sparkle-btn {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    z-index: 1;
}

.rv-alt-sparkle-btn:hover {
    background: #f0f4ff;
    border-color: #3b6fa5;
    box-shadow: 0 2px 6px rgba(59, 111, 165, 0.25);
}

/* Alt-text character counter — right side of the header row */
.rv-alt-char-counter {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    letter-spacing: 0.03em;
    white-space: nowrap;
    transition: color 0.2s ease;
    pointer-events: none;
    user-select: none;
}
.rv-alt-char-counter.rv-acc-gray   { color: #9ca3af; }
.rv-alt-char-counter.rv-acc-orange { color: #d97706; }
.rv-alt-char-counter.rv-acc-green  { color: #16a34a; }
.rv-alt-char-counter.rv-acc-red    { color: #dc2626; }

.rv-alt-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    margin-bottom: 20px;
    background: #f0f4f8;
    border: 1px solid #d0dce8;
    border-radius: 8px;
    color: #374151;
}

.rv-alt-info-banner p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
}

.rv-alt-info-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    margin-top: 1px;
    color: #3b6fa5;
    opacity: 0.85;
}

#rv-alt-editor-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    background: #f9fafb;
}

#rv-alt-save-status {
    font-size: 11px;
    font-style: italic;
    color: #6b7280;
    flex: 1 1 auto;
}

#rv-save-alt-batch {
    padding: 7px 18px;
    font-size: 12px;
    font-weight: 700;
    color: #ffffff;
    background: #16a34a;
    border: 1px solid #15803d;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.14s ease;
    flex-shrink: 0;
}

#rv-save-alt-batch:hover {
    background: #15803d;
}

#rv-save-alt-batch:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Audit trigger button */
.rv-pwa-audit-trigger {
    display: inline-block;
    margin: 6px 0 10px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    color: #3b5a8a;
    background: #ffffff;
    border: 1px solid #93aad8;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.rv-pwa-audit-trigger:hover {
    background: #eef2fb;
    border-color: #3b5a8a;
    color: #1d2d50;
}

.rv-pwa-audit-trigger:active {
    background: #dde6f8;
}

/* ── Lead-In Tool ──────────────────────────────────────────────────────── */
.rv-pwa-lead-in-tool {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rv-pwa-lead-in-current {
    resize: vertical;
    font-size: 12px;
    color: #374151;
    background: #f3f4f6;
    cursor: default;
}

.rv-pwa-lead-in-rewrite-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    align-self: flex-start;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #1d2d50;
    background: #ffffff;
    border: 1px solid #93aad8;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.14s, border-color 0.14s;
}

.rv-pwa-lead-in-rewrite-btn:hover {
    background: #eef2fb;
    border-color: #3b5a8a;
}

.rv-pwa-lead-in-rewrite-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.rv-pwa-lead-in-result {
    resize: vertical;
    font-size: 12px;
    color: #1d2d50;
    background: #f0f9ff;
    border-color: #93c5fd;
}

/* ── Lead-In Word Count Badge ──────────────────────────────────────────── */
.rv-li-wc-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}
.rv-li-wc-good  { background: #d1fae5; color: #065f46; }
.rv-li-wc-warn  { background: #fef3c7; color: #92400e; }
.rv-li-wc-empty { background: #f3f4f6; color: #6b7280; }

/* ── Lead-In Comparison Modal ──────────────────────────────────────────── */
.rv-li-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100050;
    background: rgba(0,0,0,0.65);
    align-items: center;
    justify-content: center;
}
.rv-li-modal-overlay.rv-li-modal-open {
    display: flex;
}
.rv-li-modal {
    background: #1a2236;
    border: 1px solid #2e3f5e;
    border-radius: 8px;
    width: min(900px, 94vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
}
.rv-li-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #111827;
    border-bottom: 1px solid #2e3f5e;
    flex-shrink: 0;
}
.rv-li-modal-title {
    font-size: 14px;
    font-weight: 700;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.rv-li-modal-title .dashicons {
    color: #f59e0b;
    font-size: 16px;
    width: 16px;
    height: 16px;
}
.rv-li-modal-close {
    background: none;
    border: 1px solid #374151;
    border-radius: 4px;
    color: #9ca3af;
    cursor: pointer;
    padding: 3px 6px;
    line-height: 1;
    transition: color 0.12s, border-color 0.12s;
}
.rv-li-modal-close:hover {
    color: #e2e8f0;
    border-color: #6b7280;
}
.rv-li-modal-body {
    display: flex;
    gap: 0;
    flex: 1;
    overflow: hidden;
}
.rv-li-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    min-width: 0;
}
.rv-li-panel--original {
    border-right: 1px solid #2e3f5e;
    background: #151f2e;
}
.rv-li-panel--ai {
    background: #0f1d2c;
}
.rv-li-panel-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #64748b;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 0;
}
.rv-li-panel-text {
    flex: 1;
    width: 100%;
    min-height: 160px;
    resize: none;
    background: #0d1622;
    border: 1px solid #2e3f5e;
    border-radius: 4px;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.6;
    padding: 10px 12px;
    font-family: inherit;
    box-sizing: border-box;
}
.rv-li-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 16px;
    background: #111827;
    border-top: 1px solid #2e3f5e;
    flex-shrink: 0;
}
.rv-li-audit-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #34d399;
    opacity: 0.85;
}
.rv-li-audit-badge .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #34d399;
}
/* Strategic Emphasis toggle */
.rv-li-bold-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #93c5fd;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.rv-li-bold-toggle input[type="checkbox"] {
    accent-color: #3b82f6;
    cursor: pointer;
    width: 13px;
    height: 13px;
}
.rv-li-bold-toggle .dashicons {
    font-size: 13px;
    width: 13px;
    height: 13px;
    color: #93c5fd;
}
.rv-li-bold-toggle em {
    color: #6b7280;
    font-style: italic;
}
.rv-li-footer-actions {
    display: flex;
    gap: 8px;
}
.rv-li-btn-use {
    padding: 7px 18px;
    font-size: 12px;
    font-weight: 700;
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.12s;
}
.rv-li-btn-use:hover {
    background: #1e40af;
}
.rv-li-btn-cancel {
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    color: #9ca3af;
    border: 1px solid #374151;
    border-radius: 4px;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
}
.rv-li-btn-cancel:hover {
    color: #e2e8f0;
    border-color: #6b7280;
}

/* ── Internal Links: collapsible section (first in expanded tile) ──────── */
.rv-internal-links-section {
    width: 100%;
    display: block;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.rv-il-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.rv-il-header .rv-il-title {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
    flex: 1;
}

/* Orphan warning: red title when count is zero */
.rv-il-orphan .rv-il-title {
    color: #dc2626 !important;
}

.rv-il-chevron {
    background: none;
    border: none;
    padding: 0 0 0 8px;
    cursor: pointer;
    color: #9ca3af;
    font-size: 10px;
    line-height: 1;
}

.rv-il-chevron:hover {
    color: #6b7280;
}

.rv-il-body {
    padding-top: 8px;
}

.rv-il-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rv-il-list-item {
    padding: 4px 0;
    font-size: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.rv-il-list-item:last-child {
    border-bottom: none;
}

.rv-il-list-item a {
    color: #374151;
    text-decoration: none;
}

.rv-il-list-item a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Two-column table (replaces legacy list when JS renders links) */
.rv-il-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.rv-il-th {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
    padding: 0 8px 6px 0;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.rv-il-th:last-child {
    padding-right: 0;
}

.rv-il-row {
    border-bottom: 1px solid #f3f4f6;
}

.rv-il-row:last-child {
    border-bottom: none;
}

.rv-il-td {
    padding: 5px 8px 5px 0;
    vertical-align: middle;
}

.rv-il-td:last-child {
    padding-right: 0;
}

.rv-il-td-name {
    font-size: 12px;
    color: #374151;
    width: 50%;
}

/* Slug column — identical appearance to .rv-page-tile-slug */
.rv-il-td-slug {
    width: 50%;
}

.rv-il-slug-link {
    font-size: 11px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 100%;
    line-height: 1.4;
    text-decoration: none;
    border-radius: 4px;
    padding: 1px 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

.rv-il-slug-link:hover {
    background: #dbeafe;
    color: #1d4ed8;
    text-decoration: none;
}

.rv-il-empty {
    margin: 0;
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
}

/* ── Internal Links: source badges ──────────────────────────────────────── */
.rv-il-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.rv-il-badge--content {
    background: #dbeafe;
    color: #1d4ed8;
}

.rv-il-badge--menu {
    background: #dcfce7;
    color: #15803d;
}

.rv-il-badge--widget {
    background: #fef9c3;
    color: #a16207;
}

/* Column widths for the 2-column internal links table */
.rv-il-td-source { width: 22%; vertical-align: top; padding-top: 6px; }
.rv-il-td-data   { width: 78%; }

/* Interactive data cell link */
.rv-il-data-link {
    display: block;
    text-decoration: none;
    border-radius: 4px;
    padding: 3px 6px;
    margin: -3px -6px;
    transition: background 0.15s ease;
}

.rv-il-data-link:hover {
    background: #eff6ff;
    text-decoration: none;
}

.rv-il-data-link:hover .rv-il-detail-title {
    color: #1d4ed8;
}

.rv-il-data-link:hover .rv-il-detail-slug {
    color: #3b82f6;
}

.rv-il-detail-title {
    display: block;
    font-size: 12px;
    color: #374151;
    transition: color 0.15s ease;
}

.rv-il-detail-slug {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    transition: color 0.15s ease;
}

/* ── Page Intent: full-width header above 50/50 split ──────────────────── */
.rv-intent-header-section {
    width: 100%;
    display: block;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.rv-intent-header-section .rv-pwa-section-label {
    margin: 0 0 8px;
}

/* ── Target Search Intent: pill toggles ──────────────────────────────── */
.rv-intent-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0 0 10px;
}

.rv-intent-option {
    display: flex;
    cursor: pointer;
}

.rv-intent-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.rv-intent-option span {
    display: inline-flex;
    flex-direction: column;
    padding: 6px 11px;
    font-size: 10px;
    font-weight: 600;
    text-align: left;
    color: #6b7280;
    background: #f3f4f6;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease,
                box-shadow 0.12s ease;
    white-space: normal;
    line-height: 1.4;
    user-select: none;
    max-width: 200px;
}

.rv-bucket-subtitle {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    font-weight: 400;
    color: #666;
    line-height: 1.35;
    font-style: normal;
}
.rv-bucket-subtitle b {
    font-weight: 600;
    color: #444;
}

.rv-intent-option input[type="checkbox"]:checked + span .rv-bucket-subtitle {
    color: #3b5a8a;
}

.rv-intent-option:hover span .rv-bucket-subtitle {
    color: #4b6499;
}

.rv-intent-option:hover span {
    background: #eef2fb;
    border-color: #93aad8;
    color: #1d2d50;
}

/* ── Insight Dialogue Icon ──────────────────────────────────────────────── */

.rv-insight-icon {
    color: #0056b3;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Dark-background variant: inherits light colour from the parent button
   (e.g. #e8eaf0 on layer headers / tier bars, #7dd3fc on the log refresh btn) */
.rv-insight-icon--dark {
    color: inherit;
}

@keyframes rv-spark-pulse {
    0%, 100% {
        opacity: 1;
        r: 2;
    }
    50% {
        opacity: 0.4;
        r: 3;
    }
}

.rv-spark-node {
    animation: rv-spark-pulse 1.8s ease-in-out infinite;
    transform-origin: 19px 6px;
}

.rv-intent-option input[type="checkbox"]:checked + span {
    background: #dce8fb;
    color: #1d3461;
    font-weight: 700;
    border-color: #3b5a8a;
    box-shadow: 0 0 0 2px rgba(59, 90, 138, 0.18);
}

/* Tone of Voice field (audit panel) */
.rv-pwa-tone-field {
    margin-top: 8px;
    margin-bottom: 10px;
}

.rv-pwa-tone-label {
    display: block;
    margin-bottom: 3px;
}

/* Loading pulse on audit value spans */

@keyframes rv-pwa-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

.rv-pwa-loading {
    animation: rv-pwa-pulse 0.9s ease-in-out infinite;
    font-style: italic;
    color: #6b7280 !important;
}

/* Meta editor */
.rv-pwa-field {
    margin-bottom: 10px;
}

.rv-pwa-field:last-child {
    margin-bottom: 0;
}

.rv-pwa-field-header {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
}

.rv-pwa-field-label {
    font-size: 11px;
    font-weight: 600;
    color: #374151;
}

/* ── Action bar: AI Suggest right ──────────────────────────────────────── */
.rv-pwa-action-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.rv-pwa-trust-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* Pushed to the right inside .rv-pwa-field-header */
.rv-field-trust-pills {
    margin-left: auto;
}

.rv-pwa-ai-suggest-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: #ffffff;
    border: 1px solid #93aad8;
    border-radius: 4px;
    color: #1d2d50;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.14s, border-color 0.14s;
}

.rv-pwa-ai-suggest-btn:hover {
    background: #eef2fb;
    border-color: #3b5a8a;
}

.rv-pwa-ai-suggest-btn:disabled,
.rv-pwa-ai-suggest-btn.rv-sparkle-spinning {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

/* Legacy per-field sparkle buttons — retained for alt-text tiles only */
.rv-pwa-ai-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.rv-pwa-ai-btn:hover {
    opacity: 1;
    transform: scale(1.2);
}

.rv-pwa-ai-btn.rv-sparkle-spinning {
    opacity: 1;
    animation: rv-spin 0.8s linear infinite;
    cursor: wait;
    pointer-events: none;
}

/* Linked-field sync flash: fires on both Meta Title + H1 when title AI populates them */
@keyframes rv-sync-flash-anim {
    0%   { background-color: rgba(167, 243, 208, 0.65); box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.4); }
    80%  { background-color: rgba(167, 243, 208, 0.15); box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.1); }
    100% { background-color: transparent;               box-shadow: none; }
}
.rv-sync-flash {
    animation: rv-sync-flash-anim 1.2s ease-out forwards;
}

.rv-pwa-input {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 10px;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #1d2327;
    background: #ffffff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rv-pwa-input:focus {
    outline: none;
    border-color: #3b5a8a;
    box-shadow: 0 0 0 2px rgba(59, 90, 138, 0.12);
}

textarea.rv-pwa-input {
    resize: vertical;
    min-height: 66px;
    line-height: 1.5;
}

/* ── Per-field inline save icon ─────────────────────────────────────── */
.rv-pwa-input-wrap {
    position: relative;
}

.rv-pwa-input-wrap .rv-pwa-input {
    padding-right: 30px;
}

.rv-surgical-save-icon {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    opacity: 0.25;
    border-radius: 3px;
    transition: opacity 0.3s ease, color 0.3s ease;
}

/* Floppy SVG fades out when the saved state is active */
.rv-surgical-save-icon svg {
    transition: opacity 0.3s ease;
}

/* Checkmark pseudo-element — invisible by default, cross-fades in on success */
.rv-surgical-save-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    color: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.rv-surgical-save-icon:hover {
    opacity: 1;
    color: #1d4ed8;
}

/* Success state: green icon, floppy fades out, checkmark fades in */
.rv-surgical-save-icon.rv-surgical-saved {
    opacity: 1;
    color: #16a34a;
}

.rv-surgical-save-icon.rv-surgical-saved svg {
    opacity: 0;
}

.rv-surgical-save-icon.rv-surgical-saved::after {
    content: '✓';
    opacity: 1;
}

.rv-surgical-save-icon.rv-surgical-saving {
    opacity: 0.6;
    cursor: wait;
    pointer-events: none;
}

/* For textarea wrappers, pin the icon to the top-right corner */
.rv-pwa-input-wrap:has(textarea) .rv-surgical-save-icon {
    top: 8px;
    transform: none;
}

/* Character counters — inline inside the field-header flex row */
.rv-meta-char-count {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    color: #9ca3af;
    transition: color 0.2s ease;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.rv-meta-char-count.rv-wc-red    { color: #dc2626; }
.rv-meta-char-count.rv-wc-yellow { color: #ca8a04; }
.rv-meta-char-count.rv-wc-green  { color: #16a34a; }

/* Row 2: Google Live Preview */
.rv-pwa-preview {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}

.rv-pwa-preview-card {
    background: #f1f3f4;
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    padding: 12px 16px;
    font-family: arial, sans-serif;
}

.rv-pwa-preview-url {
    font-size: 11px;
    color: #202124;
    line-height: 1.4;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rv-pwa-preview-title {
    font-size: 18px;
    color: #1a0dab;
    line-height: 1.3;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 1.3em;
}

.rv-pwa-preview-title:empty::before {
    content: '\2014';
    color: #9ca3af;
}

.rv-pwa-preview-desc {
    font-size: 13px;
    color: #4d5156;
    line-height: 1.58;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 1.58em;
}

.rv-pwa-preview-desc:empty::before {
    content: '\2014';
    color: #9ca3af;
}

/* ── Drag handle ─────────────────────────────────────────────────── */
.rv-page-tile-handle {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 18px;
    color: #d1d5db;
    cursor: grab;
    font-size: 13px;
    transition: color 0.12s ease;
    user-select: none;
}

.rv-page-tile-handle:active {
    cursor: grabbing;
}

.rv-page-tile:hover .rv-page-tile-handle {
    color: #9ca3af;
}

/* Home tier — handle locked */
.rv-page-tier-section[data-tier="home"] .rv-page-tile-handle {
    opacity: 0.18;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── SortableJS states ───────────────────────────────────────────── */

/* Ghost: the slot left behind while dragging */
.rv-page-tile.sortable-ghost {
    opacity: 0.4;
    background: #dde6f8;
    border-left: 3px solid #3b5a8a;
    box-shadow: none;
}

/* Chosen: the tile while it is being dragged */
.rv-page-tile.sortable-chosen {
    background: #f0f4ff;
    box-shadow: 0 6px 20px rgba(59, 90, 138, 0.22);
    border-radius: 4px;
}

/* Drop-zone highlight — all droppable stacks when a drag is active */
.rv-page-tile-stack.rv-sortable-active {
    background: #edf2ff;
    outline: 2px dashed #93aad8;
    outline-offset: -2px;
}

/* ── Saved pulse (green inset border) ────────────────────────────── */
@keyframes rv-tile-saved {
    0%   { box-shadow: inset 0 0 0 2px rgba(22, 163, 74, 0.0); }
    20%  { box-shadow: inset 0 0 0 2px rgba(22, 163, 74, 0.85); }
    80%  { box-shadow: inset 0 0 0 2px rgba(22, 163, 74, 0.6); }
    100% { box-shadow: inset 0 0 0 2px rgba(22, 163, 74, 0.0); }
}

.rv-page-tile--saved {
    animation: rv-tile-saved 1.3s ease forwards;
}

/* ── Market Identity Layer ──────────────────────────────────────── */

.rv-market-identity-working-area {
    padding: 4px 0 0;
}

/* Vertical stack layout */
.rv-mi-sections-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

/* Individual section card */
.rv-mi-section-card {
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    padding: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Card header — light gray background */
.rv-mi-section-header {
    background: #f3f4f6;
    border-bottom: 1px solid #e2e5ea;
    padding: 10px 16px;
}

.rv-mi-section-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #1d2327;
    letter-spacing: 0.02em;
    line-height: 1.4;
}

/* Recommendation badge text */
.rv-rec-text {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
    margin-left: 4px;
    letter-spacing: 0;
}

/* Pill editor viewport — looks like a large text input */
/* Pill editor viewport */
.rv-pill-editor-viewport {
    min-height: 120px;
    max-height: 220px;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.07);
    cursor: text;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 6px;
    overflow-y: auto;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.rv-pill-editor-viewport:focus-within {
    border-color: #3b5a8a;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.07),
                0 0 0 2px rgba(59, 90, 138, 0.12);
    outline: none;
}

/* Individual keyword pill */
.rv-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    background: #e8edf8;
    border: 1px solid #c2cfea;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #1e3a5f;
    white-space: nowrap;
    animation: rv-pill-fadein 0.18s ease;
    line-height: 1.4;
}

@keyframes rv-pill-fadein {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

/* Remove (×) button inside pill */
.rv-pill-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-style: normal;
    font-size: 13px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.12s ease, color 0.12s ease;
    flex-shrink: 0;
}

.rv-pill-remove:hover {
    background: #c2cfea;
    color: #1e3a5f;
}

/* Pill label — the clickable text portion of each pill */
.rv-pill-label {
    cursor: pointer;
}
.rv-pill-label:hover {
    text-decoration: underline dotted;
    text-underline-offset: 2px;
    background: rgba(194, 207, 234, 0.55);
    border-radius: 10px;
    padding: 1px 3px;
    margin: -1px -3px;
}

/* ── Yield Badge — circular inference-yield indicator inside each pill ─── */
/* Three states: untested (grey) / rejected (amber glow) / accepted (green glow). */
.rv-pill-yield {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    border-radius: 50%;
    flex-shrink: 0;
    user-select: none;
    cursor: default;
    transition: box-shadow 0.15s ease;
}
/* CSS tooltip via data-tooltip attribute */
.rv-pill-yield::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #f9fafb;
    font-size: 10px;
    font-weight: 500;
    font-style: normal;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    z-index: 9999;
    letter-spacing: normal;
    line-height: 1.4;
}
.rv-pill-yield:hover::after {
    opacity: 1;
    visibility: visible;
}
/* Untested — not yet offered by any plan */
.rv-pill-yield--untested {
    background: #e5e7eb;
    color: #9ca3af;
}
/* Offered — surfaced by a plan but not yet accepted (Power Blue) */
.rv-pill-yield--offered {
    background: #dbeafe;
    color: #1d4ed8;
    box-shadow: 0 0 0 1.5px rgba(59, 130, 246, 0.45);
}
.rv-pill-yield--offered:hover {
    box-shadow: 0 0 0 2.5px rgba(59, 130, 246, 0.65);
}
/* Accepted — has at least one impression (Sovereign Green glow) */
.rv-pill-yield--accepted {
    background: #d1fae5;
    color: #065f46;
    box-shadow: 0 0 0 1.5px rgba(16, 185, 129, 0.45);
}
.rv-pill-yield--accepted:hover {
    box-shadow: 0 0 0 2.5px rgba(16, 185, 129, 0.65);
}

/* Recall flash — briefly highlights viewport border when a pill is recalled into input */
@keyframes rv-pill-recall-flash {
    0%   { border-color: #3b82f6; box-shadow: inset 0 1px 3px rgba(0,0,0,0.07), 0 0 0 3px rgba(59,130,246,0.22); }
    70%  { border-color: #3b82f6; box-shadow: inset 0 1px 3px rgba(0,0,0,0.07), 0 0 0 3px rgba(59,130,246,0.22); }
    100% { border-color: #d1d5db; box-shadow: inset 0 1px 3px rgba(0,0,0,0.07); }
}
.rv-pill-editor-viewport.rv-pill-vp--recall {
    animation: rv-pill-recall-flash 0.55s ease forwards;
}

/* Edit mode: sustained purple glow while a recalled pill is being edited */
.rv-pill-editor-viewport.rv-input-edit-mode {
    border-color: #7c3aed;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.07),
                0 0 0 2px rgba(124, 58, 237, 0.22);
}

/* ── SortableJS drag-and-drop visual states ──────────────────── */

/* Pills are sortable — show grab cursor (label retains its pointer) */
.rv-pill:not(.rv-pill--ghost) {
    cursor: grab;
}

/* Ghost: placeholder hole showing where the pill will land */
.rv-pill.rv-pill--ghost {
    opacity: 0.4;
    border: 1.5px dashed #7c9fd4;
    background: rgba(232, 237, 248, 0.3);
}
.rv-pill.rv-pill--ghost .rv-pill-label,
.rv-pill.rv-pill--ghost .rv-pill-remove {
    visibility: hidden;
}

/* Drag clone: the element visually trailing the cursor */
.rv-pill.rv-pill--drag {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    cursor: grabbing !important;
    opacity: 0.95;
}

/* Chosen: pill in the grabbed state before full drag motion starts */
.rv-pill.rv-pill--chosen {
    cursor: grabbing !important;
}

/* ── Priority Highlighting — top-3 sovereign pills ───────────────────────── */
/* The first PRIORITY_COUNT pills in each viewport receive this class via
   RvSovereignPills.applyPriorityMarkings().  A Power Blue left accent + subtle
   glow signals these are the high-weight keywords AI plans will favour first.
   JS sets data-priority-rank="1|2|3" so the ::before badge shows the number. */
.rv-pill.rv-pill-priority-active {
    position: relative;
    background: #eff6ff;
    border-color: #3b82f6;
    border-left: 3px solid #3b82f6;
    color: #1d4ed8;
    font-weight: 600;
    padding-left: 7px;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.20),
                0 1px 4px rgba(59, 130, 246, 0.12);
}

/* Rank number badge — small blue circle in the upper-left corner */
.rv-pill.rv-pill-priority-active::before {
    content: attr(data-priority-rank);
    position: absolute;
    top: -6px;
    left: -6px;
    width: 14px;
    height: 14px;
    font-size: 8px;
    font-weight: 700;
    line-height: 14px;
    text-align: center;
    background: #2563eb;
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.4);
    pointer-events: none;
    z-index: 1;
}

.rv-pill.rv-pill-priority-active .rv-pill-remove:hover {
    background: #bfdbfe;
    color: #1e40af;
}

/* ── Inference Priority Boundary Separator ──────────────────────────────── */
/* Injected after the 3rd pill by RvSovereignPills.applyPriorityMarkings().
   A thin blue-tinted rule with a centred label capsule, visually declaring
   the point at which sovereign AI weighting drops to secondary priority. */
.rv-inference-boundary {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 7px 0 5px;
    pointer-events: none;   /* non-interactive — excluded from Sortable */
    user-select: none;
}

.rv-inference-boundary span {
    font-size: 9px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    white-space: nowrap;
    padding: 2px 6px;
    background: rgba(219, 234, 254, 0.55);
    border: 1px solid rgba(147, 197, 253, 0.45);
    border-radius: 3px;
}

.rv-inference-boundary::before,
.rv-inference-boundary::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient( to right, transparent, #93c5fd 35%, #93c5fd 65%, transparent );
    opacity: 0.65;
}

/* Invisible text input inside the viewport */
.rv-pill-input {
    flex-grow: 1;
    min-width: 160px;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent;
    padding: 2px 2px;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1d2327;
    line-height: 1.5;
    align-self: center;
}

/* Actions row */
.rv-mi-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 4px;
}

.rv-mi-status-msg {
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
    transition: color 0.2s ease;
}

.rv-mi-status-msg.is-success {
    color: #16a34a;
    font-style: normal;
    font-weight: 600;
}

.rv-mi-status-msg.is-error {
    color: #dc2626;
    font-style: normal;
    font-weight: 600;
}

.rv-mi-last-saved {
    font-size: 11px;
    color: #9ca3af;
    font-style: italic;
    margin-left: auto;
}

/* Section header with a Get Consulting button on the right */
.rv-mi-section-header--flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.rv-mi-section-header--flex > div {
    flex: 1;
    min-width: 0;
}

/* MI Get Consulting button — all core styling via .rv-consulting-btn */
/* Layer-header colours are set by .rv-layer-header .rv-consulting-btn above */
.rv-mi-consulting-btn {
    /* inherits everything from .rv-consulting-btn canonical class */
}

/* ── MI section-card icon-only override ─────────────────────────
   Section-level consulting buttons show only the SVG insight icon,
   no text label. Uniform 8 px padding creates a clean square action
   area; the icon's currentColor resolves to the navy via .rv-insight-icon.  */
.rv-mi-section-header .rv-consulting-btn {
    padding:    8px !important;
    height:     auto !important;
    gap:        0 !important;
    color:      #0056b3 !important;
    background: transparent !important;
    border:     1px solid transparent !important;
    border-radius: 6px !important;
}
.rv-mi-section-header .rv-consulting-btn:hover {
    background: rgba(0, 86, 179, 0.08) !important;
    border-color: rgba(0, 86, 179, 0.25) !important;
}
.rv-mi-section-header .rv-consulting-btn .rv-consult-icon {
    display:        block !important;
    color:          inherit !important;
    vertical-align: middle !important;
}

/* ── Intent Tuner Modal ─────────────────────────────────────────────────────
   Reusable focused pill editor for a single intent bucket.
   Opened via window.rvIntentTunerModal.open(intentKey, intentLabel, pillsData).
   Mirrors the card style of .rv-mi-section-card with position:fixed backdrop.
────────────────────────────────────────────────────────────────────────────── */

/* Full-screen backdrop — hidden by default; JS sets display:flex on open */
.rv-tuner-overlay {
    display:         none;
    position:        fixed;
    inset:           0;
    z-index:         99990;
    background:      rgba(0, 26, 51, 0.65);
    align-items:     center;
    justify-content: center;
    padding:         20px;
    box-sizing:      border-box;
}

/* Modal card — mirrors .rv-mi-section-card */
.rv-intent-tuner-modal {
    width:          100%;
    max-width:      540px;
    background:     #ffffff;
    border:         1px solid #e2e5ea;
    border-radius:  10px;
    box-shadow:     0 12px 40px rgba(0, 26, 51, 0.28);
    display:        flex;
    flex-direction: column;
    overflow:       hidden;
    animation:      rv-tuner-slide-in 0.18s ease;
}

@keyframes rv-tuner-slide-in {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)     scale(1); }
}

/* Header — mirrors .rv-mi-section-header */
.rv-tuner-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             12px;
    background:      #f3f4f6;
    border-bottom:   1px solid #e2e5ea;
    padding:         12px 16px;
}

.rv-tuner-title {
    margin:         0;
    font-size:      14px;
    font-weight:    700;
    color:          #1d2327;
    letter-spacing: 0.02em;
    line-height:    1.4;
}

/* Close (×) button */
.rv-tuner-close {
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           28px;
    height:          28px;
    padding:         0;
    background:      transparent;
    border:          1px solid transparent;
    border-radius:   6px;
    font-size:       18px;
    line-height:     1;
    color:           #6b7280;
    cursor:          pointer;
    flex-shrink:     0;
    transition:      background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.rv-tuner-close:hover {
    background:  #fee2e2;
    color:       #dc2626;
    border-color:#fca5a5;
}

/* Sovereign info banner — light blue capsule beneath the header */
.rv-tuner-info-banner {
    display:       flex;
    align-items:   flex-start;
    gap:           8px;
    margin:        14px 16px 0;
    padding:       9px 12px;
    background:    rgba(219, 234, 254, 0.45);
    border:        1px solid rgba(147, 197, 253, 0.55);
    border-radius: 6px;
    font-size:     12px;
    color:         #1e3a5f;
    line-height:   1.5;
}
.rv-tuner-info-banner svg {
    flex-shrink: 0;
    margin-top:  1px;
    color:       #2563eb;
}
.rv-tuner-info-banner strong {
    font-weight: 700;
    color:       #1d4ed8;
}

/* Body — wraps the pill viewport */
.rv-tuner-body {
    padding: 14px 16px 16px;
}

/* Constrain viewport height inside the modal.
   padding-top is widened to 14px so the .rv-pill-priority-active::before
   rank badge (position:absolute; top:-6px) sits fully within the overflow
   clipping boundary and is never cut off on the first pill row. */
.rv-tuner-body .rv-pill-editor-viewport {
    min-height: 100px;
    max-height: 260px;
    padding-top: 14px;
}

/* Footer — action row */
.rv-tuner-footer {
    display:     flex;
    align-items: center;
    gap:         10px;
    padding:     12px 16px;
    border-top:  1px solid #e2e5ea;
    background:  #f9fafb;
}

/* Cancel button */
.rv-tuner-cancel-btn {
    padding:       6px 16px;
    background:    transparent;
    border:        1px solid #d1d5db;
    border-radius: 6px;
    font-size:     13px;
    font-weight:   500;
    color:         #6b7280;
    cursor:        pointer;
    transition:    background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.rv-tuner-cancel-btn:hover {
    background:   #f3f4f6;
    color:        #374151;
    border-color: #9ca3af;
}

/* Status message inside footer — push to the right */
.rv-tuner-footer .rv-mi-status-msg {
    margin-left: auto;
}

/* ── Pricing Layer ──────────────────────────────────────────────── */

/* Controls bar */
.rv-pricing-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0 16px;
}

.rv-pricing-header select {
    flex: 1;
    max-width: 320px;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

#rv-pricing-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: 1px solid #2271b1;
    border-radius: 6px;
    background: #2271b1;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

#rv-pricing-refresh .dashicons {
    margin-right: 4px;
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
    color: #fff;
}

#rv-pricing-refresh:hover {
    background: #135e96;
    border-color: #135e96;
    color: #fff;
}

#rv-pricing-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#rv-pricing-refresh .dashicons.rv-spin {
    animation: rv-spin 0.8s linear infinite;
}

/* Analyze Weight button */
#rv-pricing-analyze {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: 1px solid #6b7280;
    border-radius: 6px;
    background: #6b7280;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

#rv-pricing-analyze .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
    color: #fff;
}

#rv-pricing-analyze:hover {
    background: #4b5563;
    border-color: #4b5563;
}

#rv-pricing-analyze:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Category AI Panel (embedded in Pricing Layer) ─────────────────── */

#rv-category-ai-panel {
    margin: 0 0 18px;
    background: #f9f9f9;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    overflow: hidden;
}

/* Toggle bar — mimics a WordPress postbox header */
#rv-category-ai-panel > summary.rv-category-ai-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0f0f1;
    border-bottom: 1px solid #dcdcde;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    cursor: pointer;
    user-select: none;
    list-style: none; /* hide default browser triangle */
}

#rv-category-ai-panel > summary.rv-category-ai-toggle::-webkit-details-marker {
    display: none;
}

/* Chevron icon — rotates when panel is open */
#rv-category-ai-panel > summary.rv-category-ai-toggle::after {
    content: '\f140'; /* dashicons-arrow-down */
    font-family: dashicons;
    font-size: 18px;
    line-height: 1;
    color: #787c82;
    margin-left: auto;
    display: inline-block;
    transition: transform 0.2s ease;
}

#rv-category-ai-panel[open] > summary.rv-category-ai-toggle::after {
    transform: rotate(180deg);
}

#rv-category-ai-panel > summary.rv-category-ai-toggle:hover {
    background: #e5e5e5;
}

/* Inner container */
#rv-category-row-container {
    padding: 14px 16px;
}

/* Loading / error state messages */
.rv-ai-panel-loading,
.rv-ai-panel-error {
    margin: 0;
    padding: 8px 0;
    font-size: 13px;
    color: #787c82;
}

.rv-ai-panel-error {
    color: #dc2626;
}

/* Contain the injected .rv-catalog-row so it cannot overflow the panel */
#rv-category-row-container .rv-catalog-row {
    margin-bottom: 0;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
}

/* Textarea must stay within the panel — no horizontal bleed into the grid */
#rv-category-row-container .rv-catalog-editor textarea {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Keep the header row items from wrapping awkwardly at smaller widths */
#rv-category-row-container .rv-catalog-header {
    flex-wrap: wrap;
    gap: 6px 12px;
}

/* ── Singleton row Save footer (Pricing Layer inline mode) ─────────────── */
.rv-catalog-singleton-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0 4px;
    border-top: 1px solid #e5e7eb;
    margin-top: 6px;
}

.rv-catalog-singleton-footer .rv-save-status {
    font-size: 12px;
    font-style: italic;
}

/* ── Pulse-glow: applied via JS on dirty-cell blur ──────────────────── */
@keyframes rv-pulse-glow {
    0%   { box-shadow: 0 0 0 0 rgba(26, 115, 232, 0); }
    40%  { box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.35); }
    100% { box-shadow: 0 0 0 0 rgba(26, 115, 232, 0); }
}

.rv-pulse-glow {
    animation: rv-pulse-glow 1.2s ease-out forwards;
}

/* ── Treemap Overlay ─────────────────────────────────────────────────── */
#rv-treemap-overlay {
    display: none;
    margin-top: 28px;
    border-radius: 10px;
    overflow: hidden;
    background: #1e1e1e;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    animation: rv-treemap-slide-in 0.22s ease-out;
}

@keyframes rv-treemap-slide-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}

.rv-treemap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #111111;
    border-bottom: 1px solid #333333;
}

.rv-treemap-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #f3f4f6;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.rv-treemap-title .dashicons {
    color: #60a5fa;
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 1;
}

#rv-treemap-close {
    padding: 5px 14px;
    border: 1px solid #4b5563;
    border-radius: 5px;
    background: #2d2d2d;
    color: #d1d5db;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease;
}

#rv-treemap-close:hover {
    background: #374151;
    color: #ffffff;
}

#rv-treemap-canvas {
    position: relative;
    width: 100%;
    /* 16:9 fixed aspect ratio — gives the BSP algorithm a predictable space */
    aspect-ratio: 16 / 9;
    box-sizing: border-box;
    overflow: hidden;
    background: #111111;
}

/* ── Treemap Box ─────────────────────────────────────────────────────── */
.rv-treemap-box {
    position: absolute;
    box-sizing: border-box;

    /* Solid white border so tiles are always visually separated */
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 3px;
    overflow: hidden;
    cursor: default;

    /* Flex — centres the label block both axes */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 6px;

    /* Depth cue */
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12),
                inset 0 -1px 0 rgba(0,0,0,0.25);

    transition: filter 0.15s ease, border-color 0.15s ease;
}

.rv-treemap-box:hover {
    filter: brightness(1.2);
    border-color: rgba(255, 255, 255, 0.55);
    z-index: 10;
}

/* ── Label: Product Name ─────────────────────────────────────────── */
.rv-treemap-box__name {
    width: 100%;
    /* Font scales with the container via clamp:
       min 9px, preferred 1.4% of viewport width, max 15px */
    font-size: clamp(9px, 1.4vw, 15px);
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    padding: 0 2px;

    /* 3-line clamp so names have room in larger tiles */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-break: break-word;

    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.75);
}

/* ── Label: Weight % ─────────────────────────────────────────────── */
.rv-treemap-box__weight {
    width: 100%;
    font-size: clamp(8px, 1.1vw, 12px);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 3px;
    padding: 0 2px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

/* ── Size modifiers — JS adds these based on tile pixel dimensions ── */

/* Medium tile: single-line name, no weight label */
.rv-treemap-box--sm .rv-treemap-box__name {
    -webkit-line-clamp: 1;
    font-size: 9px;
}
.rv-treemap-box--sm .rv-treemap-box__weight {
    display: none;
}

/* Tiny tile: hide everything */
.rv-treemap-box--tiny .rv-treemap-box__name,
.rv-treemap-box--tiny .rv-treemap-box__weight {
    display: none;
}


/* ── Pricing Grid Module (collapsible) ──────────────────────────────── */

#rv-pricing-grid-module {
    margin-top: 18px;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
}

#rv-pricing-grid-module > summary.rv-pricing-grid-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0f0f1;
    border-bottom: 1px solid #dcdcde;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

#rv-pricing-grid-module > summary.rv-pricing-grid-toggle::-webkit-details-marker {
    display: none;
}

#rv-pricing-grid-module > summary.rv-pricing-grid-toggle::after {
    content: '\f140'; /* dashicons-arrow-down */
    font-family: dashicons;
    font-size: 18px;
    line-height: 1;
    color: #787c82;
    margin-left: auto;
    display: inline-block;
    transition: transform 0.2s ease;
}

#rv-pricing-grid-module:not([open]) > summary.rv-pricing-grid-toggle::after {
    transform: rotate(180deg);
}

#rv-pricing-grid-module > summary.rv-pricing-grid-toggle:hover {
    background: #e5e5e5;
}

.rv-pricing-grid-body {
    overflow-x: auto; /* horizontal scroll on narrow screens, grid stays independent */
}

/* ── Physical Layer Block: label stack, button, and layout fixes ────── */

/* 1. Label Stack Fix — flex column guarantees stacking */
#rv-physical-layer-block .rv-physical-form-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    margin-bottom: 15px;
}

#rv-physical-layer-block .rv-physical-form-row label {
    font-size: 12px !important;
    font-weight: 600 !important;
    display: block !important;
    margin-bottom: 4px;
    color: #1d2327;
    line-height: 1.4;
}

/* Inputs and selects inside the block */
#rv-physical-layer-block .rv-physical-form-row input[type="number"],
#rv-physical-layer-block .rv-physical-form-row select {
    font-size: 12px;
    width: 180px;
    max-width: 100%;
    padding: 5px 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    background: #fff;
    box-sizing: border-box;
}

#rv-physical-layer-block .rv-physical-form-row input[type="number"]:focus,
#rv-physical-layer-block .rv-physical-form-row select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* 2. WP Blue Save Button */
#rv-physical-layer-block .rv-save-physical-btn {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #fff !important;
    font-size: 13px !important;
    padding: 6px 12px !important;
    cursor: pointer;
    border-radius: 3px;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}

#rv-physical-layer-block .rv-save-physical-btn:hover,
#rv-physical-layer-block .rv-save-physical-btn:focus {
    background: #135e96 !important;
    border-color: #135e96 !important;
    color: #fff !important;
}

/* Also scope the form-table variant inside the block */
#rv-physical-layer-block .rv-physical-form-table th {
    font-size: 12px;
    font-weight: 400;
}

#rv-physical-layer-block .rv-physical-form-table td input[type="number"],
#rv-physical-layer-block .rv-physical-form-table td select {
    font-size: 12px;
}

/* Physical Module (collapsible) */

#rv-physical-module-panel {
    margin-top: 18px;
    border: 1px solid #dcdcde;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
}

#rv-physical-module-panel > summary.rv-physical-module-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f0f0f1;
    border-bottom: 1px solid #dcdcde;
    font-size: 13px;
    font-weight: 600;
    color: #1d2327;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

#rv-physical-module-panel > summary.rv-physical-module-toggle::-webkit-details-marker {
    display: none;
}

#rv-physical-module-panel > summary.rv-physical-module-toggle::after {
    content: '\f140'; /* dashicons-arrow-down */
    font-family: dashicons;
    font-size: 18px;
    line-height: 1;
    color: #787c82;
    margin-left: auto;
    display: inline-block;
    transition: transform 0.2s ease;
}

#rv-physical-module-panel:not([open]) > summary.rv-physical-module-toggle::after {
    transform: rotate(180deg);
}

#rv-physical-module-panel > summary.rv-physical-module-toggle:hover {
    background: #e5e5e5;
}

#rv-physical-form-container {
    padding: 16px 20px;
}

/* ── Semantic Module (collapsible) ───────────────────────────────────────── */

#rv-semantic-module-panel {
    margin-top: 18px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    background: #f9f9f9;
    overflow: hidden;
}

#rv-semantic-module-panel > summary.rv-semantic-module-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 13px;
    color: #1d2327;
    background: #f6f7f7;
    border-bottom: 1px solid #dcdcde;
    cursor: pointer;
    list-style: none;
    user-select: none;
}

#rv-semantic-module-panel > summary.rv-semantic-module-toggle .rv-semantic-module-title {
    flex: 1 1 auto;
}

#rv-semantic-module-panel > summary.rv-semantic-module-toggle .rv-semantic-module-actions {
    margin-left: auto;
    margin-right: 10px;
    display: flex;
    align-items: center;
}

/* ── Add New Template button ─────────────────────────────────────────────── */
/* display has NO !important so jQuery .show()/.hide() inline styles can win.  */
#rv-semantic-layer-block #rv-add-template-btn,
#rv-semantic-layer-block #rv-add-template-btn.button,
#rv-semantic-layer-block #rv-add-template-btn.button-primary {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    padding: 5px 10px !important;
    height: auto !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    display: inline-block;          /* no !important — JS .show()/.hide() must override */
    text-shadow: none !important;
    box-shadow: none !important;
    vertical-align: middle !important;
    border: 1px solid #2271b1 !important;
    transition: background-color 0.15s ease !important;
}

#rv-semantic-layer-block #rv-add-template-btn:hover,
#rv-semantic-layer-block #rv-add-template-btn:focus {
    background: #135e96 !important;
    border-color: #135e96 !important;
    color: #ffffff !important;
    outline: none !important;
}

#rv-semantic-module-panel > summary.rv-semantic-module-toggle::-webkit-details-marker {
    display: none;
}

#rv-semantic-module-panel > summary.rv-semantic-module-toggle::after {
    font-family: dashicons;
    content: '\f140';
    font-size: 18px;
    line-height: 1;
    transition: transform 0.2s ease;
    transform: rotate(-90deg);
}

#rv-semantic-module-panel[open] > summary.rv-semantic-module-toggle::after {
    transform: rotate(0deg);
}

#rv-semantic-module-panel > summary.rv-semantic-module-toggle:hover {
    background: #e5e5e5;
}

/* ── Semantic Module: locked state (no template assigned) ──────────────────── */
/* .rv-module-locked is applied to the <details> element so the toggle guard
   in JS can simply check $( this ).hasClass( 'rv-module-locked' ).            */
#rv-semantic-module-panel.rv-module-locked > summary.rv-semantic-module-toggle {
    cursor: not-allowed;
    opacity: 0.75;
}

#rv-semantic-module-panel.rv-module-locked > summary.rv-semantic-module-toggle:hover {
    background: #f6f7f7; /* suppress hover colour change when locked */
}

/* Inline hint rendered via a data attribute on the summary */
#rv-semantic-module-panel.rv-module-locked > summary.rv-semantic-module-toggle::before {
    content: attr(data-locked-hint);
    font-size: 11px;
    font-weight: 400;
    color: #787c82;
    font-style: italic;
    margin-left: 8px;
    order: 2; /* sits between title (order:1) and chevron (margin-left:auto) */
}

#rv-semantic-form-container {
    padding: 16px 20px;
}

/* WP-native form-table overrides — keep column widths tidy inside the panel */
.rv-physical-form-table {
    width: 100%;
    margin: 0;
}

.rv-physical-form-table th {
    width: 220px;
    padding: 12px 10px 12px 0;
    vertical-align: middle;
    font-weight: 600;
    color: #1d2327;
}

.rv-physical-form-table td {
    padding: 8px 10px;
    vertical-align: middle;
}

.rv-physical-form-table input[type="number"],
.rv-physical-form-table select {
    width: 180px;
    max-width: 100%;
    padding: 6px 8px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
}

.rv-physical-form-table input[type="number"]:focus,
.rv-physical-form-table select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.rv-physical-module-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0 4px;
    margin-top: 4px;
    border-top: 1px solid #f0f0f1;
}

.rv-physical-module-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #50575e;
}

.rv-physical-module-notice {
    margin: 0;
    padding: 10px 0;
    font-size: 13px;
    color: #787c82;
    font-style: italic;
}

.rv-physical-module-notice--error {
    color: #dc2626;
    font-style: normal;
}

/* Grid table */
#rv-pricing-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
    background: #ffffff;
    border: 1px solid #e5e7eb;
}

#rv-pricing-grid thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #f9fafb;
}

#rv-pricing-grid th {
    padding: 8px 6px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

/* Column widths */
#rv-pricing-grid th:nth-child(1),
#rv-pricing-grid td:nth-child(1) { width: 52px;  }  /* ID       */
#rv-pricing-grid th:nth-child(2),
#rv-pricing-grid td:nth-child(2) { width: auto;  }  /* Name     */
#rv-pricing-grid th:nth-child(3),
#rv-pricing-grid td:nth-child(3) { width: 60px;  }  /* Qty      */
#rv-pricing-grid th:nth-child(4),
#rv-pricing-grid td:nth-child(4) { width: 90px;  }  /* Min Price */
#rv-pricing-grid th:nth-child(5),
#rv-pricing-grid td:nth-child(5) { width: 80px;  }  /* Min Time */
#rv-pricing-grid th:nth-child(6),
#rv-pricing-grid td:nth-child(6) { width: 80px;  }  /* Daily    */
#rv-pricing-grid th:nth-child(7),
#rv-pricing-grid td:nth-child(7) { width: 80px;  }  /* Weekly   */
#rv-pricing-grid th:nth-child(8),
#rv-pricing-grid td:nth-child(8) { width: 86px;  }  /* Monthly  */
#rv-pricing-grid th:nth-child(9),
#rv-pricing-grid td:nth-child(9) { width: 82px;  }  /* Weekend  */

.rv-pricing-cell {
    padding: 5px 6px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

#rv-pricing-grid tbody tr:nth-child(odd) .rv-pricing-cell {
    background-color: #f9fafb;
}

/* Row cursor: pointer on read-only cells, text on editable cells */
#rv-pricing-grid tbody tr {
    cursor: pointer;
}

#rv-pricing-grid tbody tr td:has( input ) {
    cursor: text;
}

#rv-pricing-grid tbody tr td input {
    cursor: text;
}

/* Selection border marker — background colours are driven by JS inline styles */
#rv-pricing-grid tbody tr.rv-selected-row td {
    border-bottom: 1px solid #7cb9e8 !important;
}

/* ── Module Disabled Overlay ──────────────────────────────────────────────── */

.rv-module-disabled .rv-module-content {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

.rv-module-placeholder {
    margin: 0;
    padding: 10px 16px;
    font-size: 13px;
    color: #787c82;
    font-style: italic;
}

.rv-pricing-cell--id {
    color: #9ca3af;
    font-size: 12px;
}

.rv-pricing-cell--name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Out-of-stock icon next to product name */
.rv-oos-icon {
    color: firebrick;
    font-size: 14px;
    vertical-align: middle;
    margin-right: 4px;
}

/* ── Personality Selector Modal ───────────────────────────────────────────── */
/* Sovereign rules: anchored to body so no parent stacking context can win. */
body > #rv-personality-selector-backdrop,
#rv-personality-selector-backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    display: none;              /* JS overrides to flex via .rv-modal-open */
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.6) !important;
}

/* Applied immediately after body-injection; cannot be beaten at this specificity. */
body > #rv-personality-selector-backdrop.rv-modal-open,
#rv-personality-selector-backdrop.rv-modal-open {
    display: flex !important;
    opacity: 1 !important;
}

body > #rv-personality-selector-backdrop #rv-personality-selector-modal,
#rv-personality-selector-modal {
    position: relative;         /* re-establish stacking context for inner content */
    background: #ffffff !important;
    border-radius: 8px !important;
    width: 440px !important;
    max-width: calc(100vw - 40px) !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    /* Ensure the modal box can never be scrolled off-screen vertically. */
    max-height: calc(100vh - 80px) !important;
    overflow-y: auto !important;
}
.rv-ps-header {
    padding: 22px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}
.rv-ps-header h3 {
    margin: 0 0 4px;
    font-size: 1.05em;
    font-weight: 700;
    color: #1e293b;
}
.rv-ps-subtitle {
    margin: 0;
    color: #64748b;
    font-size: 0.85em;
    line-height: 1.5;
}
.rv-ps-body {
    padding: 18px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.rv-ps-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.rv-ps-label {
    font-size: 0.8em;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rv-ps-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.95em;
    color: #1e293b;
    background: #fff;
    cursor: pointer;
}
.rv-ps-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}
.rv-ps-preview {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 12px 14px;
    min-height: 72px;
}
.rv-ps-preview-empty {
    margin: 0;
    color: #94a3b8;
    font-size: 0.85em;
    font-style: italic;
    text-align: center;
    padding: 8px 0;
}
.rv-ps-preview-label {
    margin: 0 0 8px;
    font-size: 0.78em;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rv-ps-preview-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.rv-ps-preview-field {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 0.82em;
    color: #334155;
    font-style: italic;
}
.rv-ps-footer {
    padding: 14px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Personality Selector — Primary "Confirm & Initialize" button */
#rv-personality-selector-modal .rv-ps-footer #rv-ps-confirm,
#rv-personality-selector-modal .rv-ps-footer #rv-ps-confirm.button,
#rv-personality-selector-modal .rv-ps-footer #rv-ps-confirm.button-primary {
    height: 32px !important;
    line-height: 30px !important;
    padding: 0 20px !important;
    background-color: #2271b1 !important;
    border: 1px solid #135e96 !important;
    color: #fff !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, border-color 0.2s ease !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

#rv-personality-selector-modal .rv-ps-footer #rv-ps-confirm:hover:not(:disabled) {
    background-color: #135e96 !important;
    border-color: #0a4b78 !important;
}

#rv-personality-selector-modal .rv-ps-footer #rv-ps-confirm:disabled {
    background-color: #a7aaad !important;
    border-color: #8c8f94 !important;
    cursor: not-allowed !important;
    opacity: 0.8 !important;
}

/* Personality Selector — Secondary "Cancel" button */
#rv-personality-selector-modal .rv-ps-footer #rv-ps-cancel,
#rv-personality-selector-modal .rv-ps-footer #rv-ps-cancel.button {
    height: 32px !important;
    line-height: 30px !important;
    padding: 0 16px !important;
    background-color: #fff !important;
    border: 1px solid #c3c4c7 !important;
    color: #3c434a !important;
    border-radius: 4px !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    cursor: pointer !important;
    transition: border-color 0.2s ease, color 0.2s ease !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

#rv-personality-selector-modal .rv-ps-footer #rv-ps-cancel:hover {
    border-color: #8c8f94 !important;
    color: #1d2327 !important;
    background-color: #f6f7f7 !important;
}

/* Spreadsheet-style inputs */
.rv-pricing-input,
#rv-pricing-grid input.rv-pricing-input,
#rv-pricing-grid input[type="number"].rv-pricing-input,
#rv-pricing-grid input[type="text"].rv-pricing-input {
    width: 100%;
    padding: 4px 5px;
    border: 2px solid transparent !important;
    border-radius: 3px;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    font-size: 13px;
    font-family: inherit;
    color: #111827;
    box-sizing: border-box;
    -moz-appearance: textfield;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.rv-pricing-input::-webkit-outer-spin-button,
.rv-pricing-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#rv-pricing-grid input.rv-pricing-input:focus,
.rv-pricing-input:focus {
    outline: none;
    border-color: #1a73e8 !important;
    background: #fff !important;
    background-color: #fff !important;
    box-shadow: none !important;
}

/* Saved-cell highlight */
.rv-cell-edited {
    background-color: #e2f3e5 !important;
}

/* Loading placeholder */
.rv-pricing-loading {
    text-align: center;
    color: #9ca3af;
    padding: 20px 0 !important;
    font-style: italic;
}

/* ── AI Truncation Warning Modal ────────────────────────────────── */
#rv-ai-truncation-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.72);
    z-index: 10010;
    display: none;
    align-items: center;
    justify-content: center;
}
#rv-ai-truncation-box {
    background: #ffffff;
    border-radius: 8px;
    max-width: 460px;
    width: 90%;
    padding: 32px 36px 28px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
    color: #1e293b;
    text-align: center;
}
#rv-ai-truncation-box .rv-trunc-icon {
    font-size: 36px;
    color: #d97706;
    line-height: 1;
    margin-bottom: 12px;
}
#rv-ai-truncation-box h3 {
    margin: 0 0 12px;
    font-size: 17px;
    font-weight: 700;
    color: #d63638;
}
#rv-ai-truncation-box p {
    margin: 0 0 24px;
    font-size: 14px;
    line-height: 1.65;
    color: #374151;
}
.rv-trunc-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ── Usage Statistics Grid ───────────────────────────────────────────────── */
.rv-settings-group--stats {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
    margin-top: 8px;
}
.rv-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.rv-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
}
.rv-stat-card--cost {
    background: #fefce8;
    border-color: #fde68a;
}
.rv-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.1;
    margin-bottom: 6px;
}
.rv-stat-card--cost .rv-stat-value {
    color: #92400e;
}
.rv-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── SEO Detection Card ──────────────────────────────────────────── */
.rv-settings-group--detection {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 24px;
    margin-bottom: 8px;
}
.rv-seo-detection-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 20px;
    border-radius: 8px;
    border: 1px solid;
    font-weight: 600;
    font-size: 14px;
}
.rv-seo-detection-card--detected {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}
.rv-seo-detection-card--native {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e40af;
}
.rv-detection-icon {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}
.rv-detection-icon--native {
    color: #3b82f6;
}
.rv-detection-label {
    flex: 1;
}
.rv-detection-slug {
    font-size: 11px;
    font-weight: 500;
    font-family: monospace;
    opacity: 0.65;
    background: rgba(0,0,0,0.06);
    padding: 2px 7px;
    border-radius: 4px;
}

/* ══ Business Identity Layer ═════════════════════════════════════ */

.rv-bi-container {
    max-width: 700px;
    padding: 10px 0;
}

.rv-bi-subheader {
    font-size: 13px;
    color: #6b7280;
    margin: -8px 0 24px;
    line-height: 1.6;
}

/* ── Tiles ───────────────────────────────────────────────────── */
.rv-bi-tile {
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    margin-bottom: 20px;
}

.rv-bi-tile-header {
    background: #f3f4f6;
    border-bottom: 1px solid #e2e5ea;
    padding: 10px 18px;
}

.rv-bi-tile-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #1d2327;
    letter-spacing: 0.02em;
}

.rv-bi-tile-body {
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Stacked fields ──────────────────────────────────────────── */
.rv-bi-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rv-bi-field-group .rv-settings-label {
    margin-bottom: 0;
}

.rv-bi-field-group .rv-settings-input {
    width: 100%;
    box-sizing: border-box;
}

.rv-bi-textarea {
    resize: vertical;
    min-height: 62px;
    line-height: 1.5;
    font-family: inherit;
}

/* ── Save row ────────────────────────────────────────────────── */
.rv-bi-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-top: 4px;
}

/* ── Warning box ─────────────────────────────────────────────── */
.rv-bi-warning-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    line-height: 1.5;
}

/* ── GBP link button ─────────────────────────────────────────── */
.rv-bi-gbp-link {
    display: inline-block;
    padding: 9px 22px;
    background: #1a73e8;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 30px;
    transition: background 0.18s ease;
    align-self: flex-start;
}

.rv-bi-gbp-link:hover {
    background: #1558b0;
    color: #ffffff;
}

/* ── GBP instructional note ──────────────────────────────────── */
.rv-bi-gbp-note {
    font-size: 13px;
    color: #374151;
    line-height: 1.6;
    margin: 0;
}

/* ── Credentials tile header: flex row for title + action button ── */
.rv-bi-tile-header--flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* ── Canonical consulting button — shared by ALL layers ─────── */
/* High-specificity selector prevents WP-admin theme bleed-in    */
#wpbody .rv-consulting-btn,
.rv-portal-root .rv-consulting-btn,
.rv-page-layer-container .rv-consulting-btn,
.rv-layer-header .rv-consulting-btn {
    display:          inline-flex !important;
    align-items:      center !important;
    gap:              5px !important;
    padding:          0 12px !important;
    height:           28px !important;
    font-size:        12px !important;
    font-weight:      600 !important;
    line-height:      1 !important;
    white-space:      nowrap !important;
    flex-shrink:      0 !important;
    cursor:           pointer !important;
    border-radius:    4px !important;
    /*  Theme resets — neutralise Twenty-* and Genesis overrides  */
    background-image: none !important;
    text-transform:   none !important;
    text-decoration:  none !important;
    box-shadow:       none !important;
    text-shadow:      none !important;
    outline:          none !important;
    letter-spacing:   0.02em !important;
    transition:       background 0.18s, border-color 0.18s, color 0.18s !important;
}

/* Layer-header (dark gradient) variant */
.rv-layer-header .rv-consulting-btn {
    color:      #e8eaf0 !important;
    background: rgba(255,255,255,0.10) !important;
    border:     1px solid rgba(255,255,255,0.26) !important;
}
.rv-layer-header .rv-consulting-btn:hover {
    background: rgba(255,255,255,0.20) !important;
    border-color: rgba(255,255,255,0.50) !important;
    color: #ffffff !important;
}

/* Tier-bar variant (coloured gradient bars) */
.rv-page-tier-bar .rv-consulting-btn {
    color:      #e8eaf0 !important;
    background: rgba(255,255,255,0.08) !important;
    border:     1px solid rgba(255,255,255,0.22) !important;
}
.rv-page-tier-bar .rv-consulting-btn:hover {
    background: rgba(255,255,255,0.18) !important;
    border-color: rgba(255,255,255,0.45) !important;
}

/* Dashicon sizing inside any consulting button */
.rv-consulting-btn .dashicons,
.rv-consulting-btn .rv-bi-consulting-icon,
.rv-consulting-btn .rv-mi-consulting-icon,
.rv-consulting-btn .rv-bi-spin {
    font-size:      14px !important;
    width:          14px !important;
    height:         14px !important;
    vertical-align: middle !important;
    line-height:    1 !important;
}
.rv-consulting-btn .rv-bi-spin {
    animation: rv-spin 0.8s linear infinite;
    display: inline-block;
}

/* ── Legacy aliases (keep for backward-compat) ───────────────── */
/* .rv-bi-consulting-btn and .rv-mi-consulting-btn now piggy-back  */
/* on .rv-consulting-btn; these rules only handle overrides.       */
.rv-bi-consulting-btn {
    /* inherits everything from .rv-consulting-btn above */
}

/* ── Goldilocks word counter ─────────────────────────────────── */
.rv-bi-word-counter {
    font-size: 11.5px;
    font-style: italic;
    color: #6b7280;
    margin: 3px 0 0;
    min-height: 16px;
    transition: color 0.2s ease;
}

.rv-bi-word-counter.rv-wc-red    { color: #dc2626; font-weight: 600; }
.rv-bi-word-counter.rv-wc-green  { color: #16a34a; font-weight: 600; }
.rv-bi-word-counter.rv-wc-orange { color: #d97706; font-weight: 600; }

/* ── Consulting response panel ───────────────────────────────── */
.rv-bi-consulting-response {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.7;
    color: #0c4a6e;
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 2px;
}

/* ── Four-Act consulting sections ───────────────────────────── */
.rv-act {
    padding: 10px 14px;
    margin-bottom: 8px;
    border-left: 4px solid #e5e7eb;
    border-radius: 0 4px 4px 0;
    line-height: 1.65;
    font-size: 13px;
}
.rv-act:last-child { margin-bottom: 0; }
.rv-act p { margin: 0; }
.rv-act-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: 5px;
    opacity: .7;
}
.rv-act-what {
    background: #f0fdf4;
    border-left-color: #4ade80;
    color: #14532d;
}
.rv-act-why {
    background: #eff6ff;
    border-left-color: #60a5fa;
    color: #1e3a5f;
}
.rv-act-ai {
    background: #fefce8;
    border-left-color: #facc15;
    color: #3f2c00;
    white-space: pre-wrap;
    word-break: break-word;
}


/* ══ Consulting Slide-Out Panel ═════════════════════════════════════ */

#rv-consulting-slideout {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    z-index: 999990;
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    box-shadow: -6px 0 32px rgba(0, 0, 0, 0.45);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#rv-consulting-slideout.rv-cs-open {
    transform: translateX(0);
}

#rv-cs-overlay {
    position: fixed;
    inset: 0;
    z-index: 999989;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}
#rv-cs-overlay.rv-cs-open {
    opacity: 1;
    pointer-events: auto;
}

/* Header ─────────────────────────────────────────────────────────── */
.rv-cs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
}
.rv-cs-logo {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.rv-cs-logo .dashicons {
    color: #3b82f6;
    font-size: 20px;
    width: 20px;
    height: 20px;
}
/* Right-side button group (mute + close) ──────────────────────────── */
.rv-cs-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Mute toggle ─────────────────────────────────────────────────────── */
.rv-cs-mute {
    background: none;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #64748b;
    cursor: pointer;
    padding: 3px 7px;
    line-height: 1;
    transition: color 0.15s, border-color 0.15s;
}
.rv-cs-mute:hover {
    color: #93c5fd;
    border-color: #64748b;
}
.rv-cs-mute--off {
    color: #475569;
    border-color: #1e293b;
    opacity: 0.55;
}
.rv-cs-mute--off:hover {
    opacity: 1;
}
.rv-cs-mute .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

.rv-cs-close {
    background: none;
    border: 1px solid #334155;
    border-radius: 4px;
    color: #94a3b8;
    cursor: pointer;
    padding: 3px 8px;
    line-height: 1;
    transition: color 0.15s, border-color 0.15s;
}
.rv-cs-close:hover {
    color: #f8fafc;
    border-color: #64748b;
}
.rv-cs-close .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    vertical-align: middle;
}

/* Scrollable body ─────────────────────────────────────────────────── */
.rv-cs-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    /* Custom scrollbar for dark theme */
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.rv-cs-body::-webkit-scrollbar        { width: 4px; }
.rv-cs-body::-webkit-scrollbar-track  { background: transparent; }
.rv-cs-body::-webkit-scrollbar-thumb  { background: #334155; border-radius: 2px; }

/* Act cards ────────────────────────────────────────────────────────── */
.rv-cs-act {
    padding: 12px 14px;
    border-radius: 6px;
    border-left: 3px solid transparent;
    font-size: 13px;
    line-height: 1.72;
}
.rv-cs-act--hidden { display: none; }

.rv-cs-act-label {
    display: block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-bottom: 7px;
    opacity: .5;
}
.rv-cs-act-what {
    background: rgba(74, 222, 128, 0.07);
    border-left-color: #4ade80;
    color: #dcfce7;
}
.rv-cs-act-why {
    background: rgba(96, 165, 250, 0.07);
    border-left-color: #60a5fa;
    color: #dbeafe;
}
.rv-cs-act-ai {
    background: rgba(250, 204, 21, 0.07);
    border-left-color: #facc15;
    color: #fef9c3;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Act 4 'Next Steps' sub-section inside the act34 container ─────── */
.rv-cs-act4-label {
    margin: 14px 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #facc15;
    border-top: 1px solid rgba(250, 204, 21, 0.25);
    padding-top: 12px;
}
.rv-cs-act4-text {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Typewriter blinking cursor ─────────────────────────────────────── */
.rv-tw-cursor {
    display: inline-block;
    width: 2px;
    height: 0.9em;
    background: currentColor;
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: rv-blink 0.65s step-end infinite;
}
@keyframes rv-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* In-flight fetching indicator ───────────────────────────────────── */
.rv-cs-fetching {
    padding: 8px 16px;
    font-size: 11.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}
.rv-cs-fetching .rv-bi-spin {
    color: #3b82f6;
    animation: rv-spin 0.8s linear infinite;
}

/* ── Follow-Up Consultant Chat ────────────────────────────────────── */
#rv-cs-chat {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px 16px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.rv-cs-chat-divider {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #475569;
    text-align: center;
}
.rv-cs-chat-divider::before,
.rv-cs-chat-divider::after {
    content: '';
    display: inline-block;
    width: 30%;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    vertical-align: middle;
    margin: 0 8px;
}
.rv-cs-chat-msgs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
}
.rv-cs-chat-msg {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12.5px;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}
.rv-cs-chat-msg--user {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: #bfdbfe;
    align-self: flex-end;
    max-width: 90%;
}
.rv-cs-chat-msg--ai {
    background: rgba(250, 204, 21, 0.07);
    border: 1px solid rgba(250, 204, 21, 0.15);
    color: #fef9c3;
    align-self: flex-start;
    max-width: 95%;
}
.rv-cs-chat-thinking {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #64748b;
    font-style: italic;
}
.rv-cs-chat-error {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(239, 68, 68, 0.07);
}
.rv-cs-chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding-bottom: 14px;
}
.rv-cs-chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 12.5px;
    padding: 8px 10px;
    resize: none;
    line-height: 1.5;
    font-family: inherit;
}
.rv-cs-chat-input::placeholder {
    color: #475569;
}
.rv-cs-chat-input:focus {
    outline: none;
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(255, 255, 255, 0.09);
}
.rv-cs-chat-send {
    padding: 7px 14px;
    background: #1e3a5f;
    border: 1px solid rgba(59, 130, 246, 0.35);
    border-radius: 6px;
    color: #93c5fd;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.rv-cs-chat-send:hover {
    background: #1d4ed8;
    color: #fff;
}
.rv-cs-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Apply Suggestion — [[ADD:…]] marker UI ─────────────────────────────── */
/* Wraps the AI-suggested value text + the Add button as an inline unit.     */
.rv-cs-add-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    vertical-align: middle;
    margin: 2px 0;
}
/* The highlighted suggested value label. */
.rv-cs-add-value {
    background: rgba( 251, 191, 36, 0.15 );
    border: 1px solid rgba( 251, 191, 36, 0.4 );
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.82em;
    color: #fbbf24;
    font-weight: 600;
}
/* Plain version when no viewport mapping exists. */
.rv-cs-add-value--no-action {
    border-color: rgba( 156, 163, 175, 0.3 );
    color: #9ca3af;
    background: transparent;
}
/* The actionable Add button. */
.rv-cs-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    font-size: 0.78em;
    font-weight: 600;
    letter-spacing: 0.02em;
    background: transparent;
    color: #60a5fa;
    border: 1px solid #60a5fa;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.rv-cs-add-btn:hover {
    background: rgba( 96, 165, 250, 0.15 );
}
/* Success state — turns green for 2.5 s then resets. */
.rv-cs-add-btn--added {
    color: #4ade80;
    border-color: #4ade80;
    background: rgba( 74, 222, 128, 0.1 );
    cursor: default;
    pointer-events: none;
}
/* Loading state — spinner while the pill is being inserted. */
.rv-cs-add-btn--loading {
    color: #93c5fd;
    border-color: #93c5fd;
    background: rgba( 147, 197, 253, 0.08 );
    cursor: wait;
    pointer-events: none;
}
/* Duplicate state — grey out permanently for this session. */
.rv-cs-add-btn--duplicate {
    color: #6b7280;
    border-color: #374151;
    background: transparent;
    cursor: default;
    pointer-events: none;
    opacity: 0.6;
}
/* ChatResponseBlock — discrete working area per AI turn. */
.rv-cs-chat-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba( 255, 255, 255, 0.06 );
    margin-bottom: 6px;
}
.rv-cs-chat-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* Sentinel — zero-height anchor at the very bottom of .rv-cs-body.
   scrollIntoView() targets this element in rvScrollPanelBottom(). */
.rv-cs-bottom-sentinel {
    height: 1px;
    visibility: hidden;
    pointer-events: none;
}

/* Quick-Action Buttons — triple-threat specificity to override theme CSS */
.rv-cs-quick-actions {
    padding: 10px 16px 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.rv-admin-portal.rv-consulting-sidebar .rv-consulting-sidebar-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}
.rv-admin-portal.rv-consulting-sidebar .rv-consulting-sidebar-actions .rv-btn-quick-action {
    /* Theme gradient / shadow / transform resets */
    background-image: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    /* Sovereign aesthetic */
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    background: transparent !important;
    border: 1px solid #4b96e0 !important;
    color: #93c5fd !important;
    border-radius: 4px !important;
    padding: 5px 12px !important;
    font-size: 12px !important;
    font-weight: normal !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
    transition: background 0.15s, color 0.15s, border-color 0.15s !important;
    margin: 0 !important;
    vertical-align: middle !important;
}
.rv-admin-portal.rv-consulting-sidebar .rv-consulting-sidebar-actions .rv-btn-quick-action:hover {
    background: rgba(75, 150, 224, 0.15) !important;
    color: #bfdbfe !important;
    border-color: #6ab0f5 !important;
}
.rv-admin-portal.rv-consulting-sidebar .rv-consulting-sidebar-actions .rv-btn-quick-action:focus {
    outline: 2px solid #4b96e0 !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
}
/* Legacy class kept for delegated click handler compatibility */
.rv-cs-qa-btn--loading {
    opacity: 0.65 !important;
    cursor: wait !important;
    pointer-events: none !important;
    border-color: rgba(75, 150, 224, 0.4) !important;
    color: #64a5d8 !important;
}
.rv-cs-qa-icon {
    font-size: 13px !important;
    width: 13px !important;
    height: 13px !important;
    vertical-align: middle;
    margin-right: 2px;
}


/* ══ Trust Signal Selectors (action bar pills) ══════════════════════ */

/* .rv-meta-trust-wrap retained for any legacy callers outside page-layer */
.rv-meta-trust-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.rv-trust-option {
    display: flex;
    cursor: pointer;
}

/* Hide the native checkbox — visuals are entirely on the <span> */
.rv-trust-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.rv-trust-option span {
    display: inline-block;
    padding: 4px 9px;
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    background: #f3f4f6;
    border: 1.5px solid #d1d5db;
    border-radius: 20px;
    transition: background 0.12s ease, color 0.12s ease,
                border-color 0.12s ease, box-shadow 0.12s ease;
    white-space: nowrap;
    line-height: 1.4;
    user-select: none;
}

.rv-trust-option:hover span {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
}

/* Checked state — green accent (distinct from blue intent pills) */
.rv-trust-option input[type="checkbox"]:checked + span {
    background: #dcfce7;
    color: #166534;
    font-weight: 700;
    border-color: #16a34a;
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.18);
}

/* ══ Button System: Primary & Secondary ════════════════════════════ */

.rv-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 16px;
    background: #2271b1;
    border: 1px solid #135e96;
    border-radius: 4px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.rv-btn-primary:hover:not(:disabled) {
    background: #135e96;
    border-color: #0c4971;
}

.rv-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.rv-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 16px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

.rv-btn-secondary:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.rv-btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ══ GBP API key button row ════════════════════════════════════════ */

.rv-bi-gbp-btn-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ══ GBP Comparison Table ════════════════════════════════════════ */

.rv-gbp-comparison-wrap {
    margin-top: 6px;
}

.rv-gbp-comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    overflow: hidden;
}

.rv-gbp-comparison-table thead tr {
    background: #f3f4f6;
}

.rv-gbp-comparison-table th {
    padding: 9px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #1d2327;
    border-bottom: 1px solid #e2e5ea;
    letter-spacing: 0.02em;
}

.rv-gbp-comparison-table td {
    padding: 9px 12px;
    vertical-align: top;
    border-bottom: 1px solid #e2e5ea;
    line-height: 1.5;
}

.rv-gbp-comparison-table tbody tr:last-child td {
    border-bottom: none;
}

/* Match row — soft green tint */
.rv-gbp-cmp-row--match {
    background: #f0fdf4;
}

/* Mismatch row — soft red tint */
.rv-gbp-cmp-row--mismatch {
    background: #fff7f7;
}

.rv-gbp-cmp-field {
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.rv-gbp-empty {
    font-style: italic;
    color: #9ca3af;
}

/* Status badges */
.rv-gbp-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.rv-gbp-badge--match {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.rv-gbp-badge--mismatch {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Sync row */
.rv-gbp-sync-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.rv-gbp-sync-note {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

/* All-match notice */
.rv-gbp-all-match {
    margin: 12px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #166534;
}

/* Verify error */
.rv-gbp-verify-error {
    margin: 8px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #991b1b;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Blueprint Layer
   ═══════════════════════════════════════════════════════════════════════════ */

.rv-blueprint-layer {
    padding: 0 0 40px;
}

.rv-blueprint-subtitle {
    margin: 4px 0 24px;
    font-size: 14px;
    color: #6b7280;
}

/* ── Loading state ─────────────────────────────────────────────────────── */
.rv-bp-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 32px 0;
    font-size: 14px;
    color: #6b7280;
}

.rv-bp-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-top-color: #1a1a2e;
    border-radius: 50%;
    animation: rv-bp-spin 0.6s linear infinite;
}

@keyframes rv-bp-spin {
    to { transform: rotate(360deg); }
}

/* ── Error state ────────────────────────────────────────────────────────── */
.rv-bp-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
    color: #991b1b;
}

.rv-bp-error-icon {
    font-size: 16px;
}

/* ── Status grid ────────────────────────────────────────────────────────── */
.rv-bp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.rv-bp-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px 22px 18px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.rv-bp-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.rv-bp-card-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.rv-bp-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    flex: 1;
}

/* ── Status badge ───────────────────────────────────────────────────────── */
.rv-bp-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
    flex-shrink: 0;
}

.rv-bp-badge--good {
    background: #dcfce7;
    color: #166534;
}

.rv-bp-badge--partial {
    background: #fef9c3;
    color: #854d0e;
}

.rv-bp-badge--empty {
    background: #f3f4f6;
    color: #6b7280;
}

/* ── Stat rows ──────────────────────────────────────────────────────────── */
.rv-bp-card-stats {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rv-bp-stat {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 5px;
}

.rv-bp-stat:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.rv-bp-stat-label {
    color: #6b7280;
    flex-shrink: 0;
}

.rv-bp-stat-value {
    color: #111827;
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .rv-bp-grid {
        grid-template-columns: 1fr;
    }

    /* Stack Lead-In above Meta Editor on small screens (Lead-In is first in DOM). */
    .rv-pwa-split {
        flex-direction: column;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
   Blueprint — Zone Diagnostics Table
   ══════════════════════════════════════════════════════════════════════════ */

.rv-bp-zones-header {
    display: block;
    margin: 32px 0 0;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    background: #374151;
    border-radius: 6px 6px 0 0;
}

.rv-bp-zones-subtitle {
    margin: 0 0 20px;
    padding: 10px 20px 0;
    font-size: 13px;
    color: #6b7280;
}

.rv-bp-zones {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── Zone section card ──────────────────────────────────────────────────── */
.rv-bp-zone-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.rv-bp-zone-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.rv-bp-zone-label {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
}

.rv-bp-zone-yield {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

.rv-bp-zone-yield--high {
    background: #dcfce7;
    color: #166534;
}

.rv-bp-zone-yield--low {
    background: #fef3c7;
    color: #92400e;
}

.rv-bp-zone-yield--contextual {
    background: #ede9fe;
    color: #5b21b6;
}

.rv-bp-zone-sources {
    font-size: 12px;
    color: #9ca3af;
    margin-left: auto;
    font-style: italic;
}

/* ── Home Page zone: H-anchor row ──────────────────────────────────────── */
.rv-bp-home-anchor {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px 10px;
    border-bottom: 1px solid #f3f4f6;
    background: #fffbeb;
}

.rv-bp-home-anchor-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Sub-label above the content-link targets table */
.rv-bp-zone-sub-label {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    border-bottom: 1px solid #f3f4f6;
    background: #fafafa;
}

/* Dynamic posts-front notice */
.rv-bp-home-note {
    padding: 14px 20px;
    font-size: 13px;
    color: #374151;
    background: #fffbeb;
    border-top: 1px solid #fde68a;
    line-height: 1.55;
}

.rv-bp-home-note strong {
    color: #92400e;
}

/* ── Zone table (CSS table layout) ─────────────────────────────────────── */
.rv-bp-zone-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
}

.rv-bp-zt-row {
    display: table-row;
}

.rv-bp-zt-row--head .rv-bp-zt-cell {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    padding-top: 9px;
    padding-bottom: 9px;
    border-bottom: 1px solid #e5e7eb;
}

.rv-bp-zt-row:not(.rv-bp-zt-row--head) {
    border-bottom: 1px solid #f3f4f6;
}

.rv-bp-zt-row:not(.rv-bp-zt-row--head):last-child {
    border-bottom: none;
}

.rv-bp-zt-row--warn {
    background: #fffbeb;
}

.rv-bp-zt-cell {
    display: table-cell;
    padding: 10px 16px;
    vertical-align: middle;
    font-size: 13px;
    color: #374151;
}

.rv-bp-zt-col-page      { width: 27%; }
.rv-bp-zt-col-layer     { width: 7%;  text-align: center; }
.rv-bp-zt-col-keyword   { width: 24%; }
.rv-bp-zt-col-rank      { width: 8%;  text-align: center; }
.rv-bp-zt-col-intensity { width: 9%;  text-align: center; }
.rv-bp-zt-col-linked-by { width: 12%; }
.rv-bp-zt-col-depth     { width: 8%;  text-align: center; }

/* ── Focus Keyword column ────────────────────────────────────────────────── */
.rv-bp-kw-text {
    font-size: 12px;
    font-weight: 500;
    color: #1f2937;
    letter-spacing: 0.01em;
    display: block;
}
.rv-bp-kw-pending {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
    font-style: italic;
}
.rv-bp-kw-none {
    font-size: 11px;
    font-weight: 500;
    color: #ef4444;
    font-style: italic;
}
.rv-bp-kw-h1-warning {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: #ef4444;
    margin-top: 3px;
    letter-spacing: 0.01em;
}

/* ── Linked By column items ──────────────────────────────────────────────── */
.rv-bp-lb-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    white-space: nowrap;
    width: fit-content;
}
.rv-bp-lb-item:last-child {
    margin-bottom: 0;
}
.rv-bp-lb-label {
    font-size: 11px;
    font-weight: 500;
    min-width: 38px;
}
.rv-bp-lb-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: default;
}
/* Color variants — match Source Governance Audit type palette */
.rv-bp-lb-badge--menu,
.rv-bp-lb-label--menu   { color: #1e40af; }
.rv-bp-lb-badge--menu   { background: #dbeafe; }
.rv-bp-lb-badge--widget,
.rv-bp-lb-label--widget { color: #5b21b6; }
.rv-bp-lb-badge--widget { background: #ede9fe; }
.rv-bp-lb-badge--page,
.rv-bp-lb-label--page   { color: #374151; }
.rv-bp-lb-badge--page   { background: #f3f4f6; }
.rv-bp-lb-none {
    color: #9ca3af;
}

/* ── Page deep-link button ──────────────────────────────────────────────── */
.rv-bp-page-link {
    display: block;
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.18s, color 0.18s;
    line-height: 1.4;
}

.rv-bp-page-link:hover {
    color: #2563eb;
    text-decoration-color: #2563eb;
}

.rv-bp-zt-slug {
    display: block;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
    font-style: italic;
    font-weight: 400;
}

/* ── Layer icon circle ──────────────────────────────────────────────────── */
.rv-bp-layer-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    /* background-color and color set inline via JS */
}

/* Ghost (no-index) icon — diagonal white strike-through */
.rv-bp-layer-icon--ghost {
    position: relative;
    overflow: hidden;
    opacity: 0.72;
    cursor: help;
}

.rv-bp-layer-icon--ghost::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 145%;          /* longer than the diagonal of the 26×26 circle */
    height: 2px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 1px;
    transform: translate(-50%, -50%) rotate(-45deg);
    pointer-events: none;
}

/* ── Target rank badge ──────────────────────────────────────────────────── */
.rv-bp-rank-badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.rv-bp-rank--high {
    background: #dcfce7;
    color: #166534;
}

.rv-bp-rank--mid {
    background: #fef3c7;
    color: #92400e;
}

.rv-bp-rank--low {
    background: #f3f4f6;
    color: #6b7280;
}

.rv-bp-rank--noindex {
    background: #e5e7eb;
    color: #6b7280;
    text-decoration: line-through;
    opacity: 0.75;
}

.rv-bp-rank-none {
    color: #d1d5db;
    font-size: 13px;
}

/* ── Page Depth badge ───────────────────────────────────────────────────── */
.rv-bp-depth-badge {
    display: inline-block;
    min-width: 26px;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    cursor: default;
}

.rv-bp-depth--home {
    background: #fde68a;
    color: #78350f;
}

.rv-bp-depth--direct {
    background: #d1fae5;
    color: #065f46;
}

.rv-bp-depth--two {
    background: #dbeafe;
    color: #1e40af;
}

.rv-bp-depth--deep {
    background: #2a2a2a;
    color: #9ca3af;
    border: 1px solid #374151;
}

.rv-bp-depth-unknown {
    color: #4b5563;
    font-size: 13px;
}

/* ── Page Intensity Score badge ─────────────────────────────────────── */
.rv-bp-intensity-badge {
    display: inline-block;
    min-width: 36px;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    cursor: default;
}

.rv-bp-intensity--high {
    background: #d1fae5;
    color: #065f46;
}

.rv-bp-intensity--mid {
    background: #fef3c7;
    color: #92400e;
}

.rv-bp-intensity--low {
    background: #fee2e2;
    color: #991b1b;
}

.rv-bp-intensity--none {
    color: #4b5563;
    font-size: 13px;
}

/* ── Alignment column indicators ────────────────────────────────────────── */
.rv-bp-warn-icon {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: #b45309;
}

.rv-bp-align--ok {
    font-size: 12px;
    font-weight: 600;
    color: #166534;
}

.rv-bp-align--neutral {
    color: #d1d5db;
    font-size: 13px;
}

/* ── Empty zone state ───────────────────────────────────────────────────── */
.rv-bp-empty-zone {
    padding: 16px 20px;
    font-size: 13px;
    color: #9ca3af;
    font-style: italic;
}

/* ── Deep-link highlight pulse (applied to .rv-page-tile) ──────────────── */
@keyframes rv-bp-highlight-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(37, 99, 235, 0.35); }
    50%  { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0.12); }
    100% { box-shadow: 0 0 0 0   rgba(37, 99, 235, 0);    }
}

.rv-bp-highlight {
    animation: rv-bp-highlight-pulse 1.8s ease-out forwards;
}

/* ══════════════════════════════════════════════════════════════════════════
   Blueprint — Linkage Graph
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Global Linkage Map header toggle ───────────────────────────────────── */
.rv-bp-gmap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.rv-bp-gmap-header:hover {
    background: #4b5563;
}

.rv-bp-gmap-chevron {
    font-size: 18px;
    line-height: 1;
    transition: transform 0.2s ease;
}

.rv-bp-gmap-header.rv-bp-gmap-open .rv-bp-gmap-chevron {
    transform: rotate(90deg);
}

/* ── Graph container ─────────────────────────────────────────────────────── */
#rv-bp-graph-wrap {
    position: relative;
    margin-top: 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

/* ── Graph header + legend ───────────────────────────────────────────────── */
.rv-bp-graph-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.rv-bp-graph-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
    flex-shrink: 0;
}

.rv-bp-graph-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.rv-bp-gl-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
}

.rv-bp-gl-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.rv-bp-gl-dot--orphan {
    background: transparent !important;
    border: 2px dashed #ef4444;
}

.rv-bp-gl-lline {
    display: inline-block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── SVG canvas ──────────────────────────────────────────────────────────── */
.rv-bp-graph-canvas {
    width: 100%;
    height: 520px;
    overflow: hidden;
    position: relative;
    background: #fafafa;
    cursor: grab;
}

.rv-bp-graph-canvas:active {
    cursor: grabbing;
}

.rv-bp-graph-canvas svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ── Node title labels in the D3 graph ───────────────────────────────────── */
/* Base styling — fine details are set inline by D3 so only font-smoothing     */
/* and a transition shim live here.                                            */
.rv-bp-node-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    user-select: none;
}

/* ── Loading / error inside graph wrap ──────────────────────────────────── */
.rv-bp-graph-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 20px;
    font-size: 13px;
    color: #6b7280;
}

.rv-bp-graph-error {
    padding: 14px 20px;
    font-size: 13px;
    color: #991b1b;
    font-style: italic;
}

/* ── Node summary card popup ─────────────────────────────────────────────── */
.rv-bp-graph-card {
    position: absolute;
    z-index: 20;
    width: 260px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
    padding: 14px 16px 12px;
    pointer-events: all;
}

.rv-bp-graph-card-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    font-size: 17px;
    line-height: 1;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    transition: color 0.15s;
}

.rv-bp-graph-card-close:hover {
    color: #374151;
}

.rv-bp-graph-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 10px;
    padding-right: 22px;
    line-height: 1.45;
}

.rv-bp-gc-dl {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
    font-size: 12px;
}

.rv-bp-gc-dl dt {
    color: #9ca3af;
    font-weight: 600;
    white-space: nowrap;
    margin: 0;
}

.rv-bp-gc-dl dd {
    color: #374151;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.rv-bp-gc-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.15s;
}

.rv-bp-gc-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.rv-bp-gc-orphan {
    display: inline-block;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   Blueprint — Source Governance Audit Table
   ══════════════════════════════════════════════════════════════════════════ */

/* Legend row above the table */
.rv-bp-audit-legend {
    margin: 0 0 16px;
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

/* Table wrapper */
.rv-bp-audit-table-wrap {
    overflow-x: auto;
}

.rv-bp-audit-table {
    width: 100%;
    min-width: 560px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    font-size: 13px;
}

/* ── Rows ───────────────────────────────────────────────────────────────── */
.rv-bp-audit-row {
    display: grid;
    grid-template-columns: 1fr 100px 100px 130px 130px;
    border-bottom: 1px solid #f3f4f6;
}

.rv-bp-audit-row:last-child {
    border-bottom: none;
}

.rv-bp-audit-row--head {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

/* ── Cells ──────────────────────────────────────────────────────────────── */
.rv-bp-audit-cell {
    padding: 10px 16px;
    display: flex;
    align-items: center;
}

.rv-bp-audit-col-count {
    justify-content: center;
}

/* ── Link Count badge — reuses lb-badge geometry ───────────────────────── */
.rv-bp-audit-count-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: default;
}
.rv-bp-audit-count-badge--menu   { background: #dbeafe; color: #1e40af; }
.rv-bp-audit-count-badge--widget { background: #ede9fe; color: #5b21b6; }
.rv-bp-audit-count-badge--page   { background: #f3f4f6; color: #374151; }
.rv-bp-audit-count-badge--zero   { background: #f3f4f6; color: #9ca3af; }
/* ── Link Count badge tooltip (JS panel) ────────────────────────────────── */
.rv-bp-audit-count-badge[data-rv-audit-titles] {
    cursor: help;
}
#rv-bp-audit-tip {
    position: fixed;
    z-index: 99999;
    background: #1e293b;
    color: #f8fafc;
    border-radius: 6px;
    padding: 8px 12px;
    pointer-events: none;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    max-width: 280px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#rv-bp-audit-tip ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
#rv-bp-audit-tip li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
    padding: 3px 0;
}
#rv-bp-audit-tip li + li {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 4px;
    margin-top: 1px;
}

.rv-bp-audit-col-health {
    justify-content: center;
}

.rv-bp-audit-col-missing {
    justify-content: center;
}

/* ── Column header row override (white bg inside section card) ─────────── */
.rv-bp-audit-row--col-head {
    background: #fff;
}

/* ── Section head legend inline pills ──────────────────────────────────── */
.rv-bp-audit-section-head {
    flex-wrap: wrap;
    gap: 8px 16px;
}

/* ════════════════════════════════════════════════════════════════════════
   Prompt Preview Modal — Technical Blueprint
   ════════════════════════════════════════════════════════════════════════ */

/* Overlay — hidden until .rv-pp-open is added */
.rv-pp-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 99998;
    align-items: center;
    justify-content: center;
}
.rv-pp-overlay.rv-pp-open {
    display: flex;
}

/* Prevent the page from scrolling while the modal is open */
body.rv-pp-scroll-lock {
    overflow: hidden;
}

/* Modal shell */
.rv-pp-modal {
    background: #fff;
    border-radius: 8px;
    width: min(880px, 94vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .28);
}

/* ── Header bar ─────────────────────────────────────────────────────────── */
.rv-pp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid #1e3a5f;
    background: #001a33;
    color: #fff;
    flex-shrink: 0;
}
.rv-pp-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.rv-pp-header-icon {
    opacity: .75;
    flex-shrink: 0;
}
.rv-pp-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
    color: #fff;
    text-transform: uppercase;
}
.rv-pp-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, .6);
}
.rv-pp-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .7);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    transition: color .12s;
}
.rv-pp-close:hover { color: #fff; }

/* ── Info banner ────────────────────────────────────────────────────────── */
.rv-pp-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 20px;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
    font-size: 12px;
    color: #1e40af;
    flex-shrink: 0;
}
.rv-pp-banner svg { flex-shrink: 0; margin-top: 1px; }

/* ── Scrollable step list ────────────────────────────────────────────────── */
.rv-pp-body {
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1 1 auto;
}

/* ── Individual step block ──────────────────────────────────────────────── */
.rv-pp-step {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}
.rv-pp-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}
.rv-pp-step-plan-id {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    color: #001a33;
    text-transform: uppercase;
    flex: 1;
}
.rv-pp-step-plan-code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 10px;
    color: #6b7280;
    background: #e2e8f0;
    padding: 2px 7px;
    border-radius: 3px;
}

/* ── Prompt textarea ────────────────────────────────────────────────────── */
.rv-pp-prompt-textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11.5px;
    line-height: 1.6;
    color: #1e293b;
    background: #fafafa;
    border: none;
    resize: vertical;
    overflow-y: auto;
    outline: none;
    cursor: text;
    min-height: 120px;
    max-height: 220px;
}
.rv-pp-prompt-textarea:focus { background: #f1f5f9; }

/* ── Singleton mode (1 prompt — e.g. Lead-In Rewrite) ──────────────────── */
/* The modal narrows slightly and the single textarea fills all available    */
/* vertical space so it reads like a full-screen document, not a small box.  */
/* Both the BEM modifier (.rv-pp-modal--singleton) and the utility class     */
/* (.is-singleton) are applied by JS simultaneously as aliases.              */
.rv-pp-modal--singleton,
.rv-pp-modal.is-singleton {
    width: min(680px, 94vw);
}
.rv-pp-modal--singleton .rv-pp-body,
.rv-pp-modal.is-singleton .rv-pp-body {
    /* Remove multi-step gap — only one child exists */
    gap: 0;
}
.rv-pp-modal--singleton .rv-pp-step,
.rv-pp-modal.is-singleton .rv-pp-step {
    /* Let the step block grow to fill the body */
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.rv-pp-modal--singleton .rv-pp-prompt-textarea,
.rv-pp-modal.is-singleton .rv-pp-prompt-textarea {
    flex: 1 1 auto;
    resize: none;
    min-height: 400px;
    max-height: none;
    height: 100%;
}

/* ── MetaCrew mode (4 prompts — default multi-step report) ──────────────── */
/* No structural changes needed; this class exists as a semantic anchor and  */
/* to allow future overrides without touching the base rules.                */
.rv-pp-modal--metacrew .rv-pp-prompt-textarea {
    min-height: 120px;
    max-height: 220px;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.rv-pp-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 13px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}
.rv-pp-btn-close {
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 7px 16px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: background .12s;
}
.rv-pp-btn-close:hover { background: #f3f4f6; }
.rv-pp-btn-send {
    background: #001a33;
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .02em;
    transition: background .15s;
}
.rv-pp-btn-send:hover { background: #003060; }

/* Empty state */
.rv-pp-empty {
    color: #9ca3af;
    font-style: italic;
    font-size: 13px;
    padding: 8px 0;
}

/* ── Preview Prompts toggle switch (inline with AI Suggest button) ───────── */
.rv-pwa-preview-toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}
.rv-pwa-preview-toggle,
.rv-pwa-li-preview-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 32px;
    height: 18px;
    background: #d1d5db;
    border-radius: 9px;
    position: relative;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.rv-pwa-preview-toggle::after,
.rv-pwa-li-preview-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.rv-pwa-preview-toggle:checked,
.rv-pwa-li-preview-toggle:checked {
    background: #3b82f6;
}
.rv-pwa-preview-toggle:checked::after,
.rv-pwa-li-preview-toggle:checked::after {
    transform: translateX(14px);
}

.rv-bp-audit-legend-inline {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-left: auto;
}

/* ── Clickable data rows ────────────────────────────────────────────────── */
.rv-bp-audit-row--clickable {
    cursor: pointer;
    transition: background 0.1s;
}

.rv-bp-audit-row--clickable:hover {
    background: #f9fafb;
}

/* ── Source Name link ───────────────────────────────────────────────────── */
.rv-bp-audit-source-link {
    color: #1a1a2e;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.rv-bp-audit-source-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* ── Type badge ─────────────────────────────────────────────────────────── */
.rv-bp-audit-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.rv-bp-audit-type--menu {
    background: #dbeafe;
    color: #1e40af;
}

.rv-bp-audit-type--widget {
    background: #ede9fe;
    color: #5b21b6;
}

.rv-bp-audit-type--page {
    background: #f3f4f6;
    color: #374151;
}

/* ── Health Score badge ─────────────────────────────────────────────────── */
.rv-bp-health-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.rv-bp-health--pristine {
    background: #dcfce7;
    color: #166534;
}

.rv-bp-health--strained {
    background: #fef3c7;
    color: #92400e;
}

.rv-bp-health--diluted {
    background: #fee2e2;
    color: #991b1b;
}

/* ── Missing Links column ───────────────────────────────────────────────── */
.rv-bp-audit-missing--zero {
    color: #9ca3af;
    font-size: 13px;
}

.rv-bp-audit-missing-count {
    font-size: 13px;
    font-weight: 700;
    color: #dc2626;
}

/* ── Row group ──────────────────────────────────────────────────────────── */
.rv-bp-audit-row-group {
    border-bottom: 1px solid #f3f4f6;
}

.rv-bp-audit-row-group > .rv-bp-audit-row {
    border-bottom: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   Source Audit — Detail Modal
   ════════════════════════════════════════════════════════════════════════════ */

.rv-sa-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rv-sa-modal {
    background: #fff;
    border-radius: 12px;
    width: 560px;
    max-width: 96vw;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.rv-sa-modal-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid #e5e7eb;
}

.rv-sa-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    flex: 1;
    margin: 0;
    line-height: 1.4;
}

.rv-sa-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 22px;
    color: #9ca3af;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.rv-sa-modal-close:hover {
    color: #374151;
}

.rv-sa-modal-body {
    overflow-y: auto;
    padding: 20px 24px;
    flex: 1;
}

.rv-sa-modal-meta {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 18px;
}

.rv-sa-modal-stat {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 16px;
    flex: 1;
}

.rv-sa-modal-stat-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 5px;
}

.rv-sa-modal-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
}

.rv-sa-modal-section-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
    margin: 16px 0 8px;
}

.rv-sa-modal-section-label--broken {
    color: #dc2626;
}

.rv-sa-modal-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.rv-sa-modal-list li {
    font-size: 13px;
    color: #374151;
    padding: 5px 10px;
    border-radius: 5px;
    background: #f9fafb;
    word-break: break-word;
}

.rv-sa-modal-list--broken li {
    color: #991b1b;
    background: #fef2f2;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.rv-sa-modal-empty {
    font-size: 13px;
    color: #9ca3af;
    font-style: italic;
    margin: 0;
}

.rv-sa-admin-link {
    display: inline-block;
    margin-top: 18px;
    font-size: 13px;
    color: #2563eb;
    text-decoration: none;
}

.rv-sa-admin-link:hover {
    text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AI AGENCY LOG LAYER
   .rv-log-filter-bar  ·  #rv-log-grid-container  ·  .rv-log-row
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Filter Bar ──────────────────────────────────────────────────────────── */

.rv-log-filter-bar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px 16px;
    padding: 16px 20px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 20px;
}

.rv-log-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rv-log-filter-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
}

.rv-log-date-input,
.rv-log-plan-select {
    height: 36px;
    padding: 0 10px;
    font-size: 13px;
    color: #1f2937;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    transition: border-color 0.15s;
}

.rv-log-date-input {
    min-width: 200px;
    cursor: pointer;
}

.rv-log-date-input:focus,
.rv-log-plan-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.rv-log-plan-select {
    min-width: 180px;
}

/* Refresh button */
.rv-log-refresh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    width: 36px;
    padding: 0;
    background: #001a33;
    border: none;
    border-radius: 6px;
    color: #7dd3fc;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.rv-log-refresh-btn:hover {
    background: #002a52;
    color: #38bdf8;
}

.rv-log-refresh-btn .rv-insight-icon {
    display: block;
}

/* ── Summary Tiles ───────────────────────────────────────────────────────── */

#rv-log-summary-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.rv-log-summary-tile {
    flex: 1 1 160px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 20px;
    border-radius: 8px;
    border: 1px solid transparent;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    min-width: 140px;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
}

.rv-log-summary-tile:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.11);
}

.rv-log-summary-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.rv-log-summary-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    transition: opacity 0.2s;
}

/* Colour variants */
.rv-log-summary-prompt {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-color: #bfdbfe;
}
.rv-log-summary-prompt .rv-log-summary-label { color: #1d4ed8; }
.rv-log-summary-prompt .rv-log-summary-value { color: #1e40af; }

.rv-log-summary-reasoning {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border-color: #c4b5fd;
}
.rv-log-summary-reasoning .rv-log-summary-label { color: #6d28d9; }
.rv-log-summary-reasoning .rv-log-summary-value { color: #4c1d95; }

.rv-log-summary-completion {
    background: linear-gradient(135deg, #f0fdf4 0%, #d1fae5 100%);
    border-color: #a7f3d0;
}
.rv-log-summary-completion .rv-log-summary-label { color: #059669; }
.rv-log-summary-completion .rv-log-summary-value { color: #065f46; }

.rv-log-summary-total {
    background: linear-gradient(135deg, #001a33 0%, #002d5a 100%);
    border-color: #003366;
}
.rv-log-summary-total .rv-log-summary-label { color: #7dd3fc; }
.rv-log-summary-total .rv-log-summary-value { color: #fff; }

/* Empty state — dash at reduced opacity */
#rv-log-summary-tiles.rv-log-summary--empty .rv-log-summary-value {
    opacity: 0.35;
    font-size: 22px;
}

/* Loading state — pulsing "···" */
#rv-log-summary-tiles.rv-log-summary--loading .rv-log-summary-value {
    font-size: 20px;
    animation: rv-summary-pulse 1.1s ease-in-out infinite;
}

@keyframes rv-summary-pulse {
    0%, 100% { opacity: 0.2; }
    50%       { opacity: 0.6; }
}

/* ── Tile rebuild fade-in ─────────────────────────────────────────────────
 * Applied to every .rv-log-summary-tile built by rv_render_token_summary().
 * Because tiles are recreated from scratch on each refresh the animation
 * fires fresh, giving users clear visual feedback that the Yield has been
 * re-calculated.  Staggered nth-child delays produce a cascade effect.
 */
.rv-log-tile-fadein {
    animation: rv-log-tile-fadein 0.28s ease-out both;
}
.rv-log-summary-tile:nth-child(1).rv-log-tile-fadein { animation-delay:   0ms; }
.rv-log-summary-tile:nth-child(2).rv-log-tile-fadein { animation-delay:  55ms; }
.rv-log-summary-tile:nth-child(3).rv-log-tile-fadein { animation-delay: 110ms; }
.rv-log-summary-tile:nth-child(4).rv-log-tile-fadein { animation-delay: 165ms; }

@keyframes rv-log-tile-fadein {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0);   }
}

/* ── Trend Graph Stage ───────────────────────────────────────────────────── */

.rv-log-graph-stage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

/* Bookend tiles — left (#rv-graph-meta-first) and right (#rv-graph-meta-last) */
.rv-graph-meta-tile {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 140px;
    min-width: 120px;
    padding: 14px 16px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    align-self: stretch;        /* fills the same height as the canvas wrapper */
    justify-content: center;
}

.rv-graph-meta-seq-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    line-height: 1;
    margin-bottom: 4px;
}

.rv-graph-meta-plan-id {
    font-size: 12px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
    word-break: break-all;
}

.rv-graph-meta-datetime {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
}

/* Center canvas wrapper — grows to fill remaining space */
.rv-log-graph-canvas-wrap {
    flex: 1 1 0;
    min-width: 0;
    min-height: 120px;
    position: relative;
}

#rv-token-trend-chart {
    display: block;
    width: 100% !important;
    height: 140px !important;
}

/* Empty / loading states ──────────────────────────────────────────────────── */

.rv-log-graph-stage.rv-graph--empty .rv-graph-meta-plan-id,
.rv-log-graph-stage.rv-graph--empty .rv-graph-meta-datetime {
    color: #d1d5db;
}

/* ── Empty / loading states ──────────────────────────────────────────────── */

.rv-log-empty-msg {
    font-size: 13px;
    color: #9ca3af;
    font-style: italic;
    margin: 24px 0 0;
    text-align: center;
}

/* ── Results Grid ────────────────────────────────────────────────────────── */

#rv-log-grid-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Row Tile ────────────────────────────────────────────────────────────── */

.rv-log-row {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    transition: border-color 0.15s;
}

.rv-log-row:hover {
    border-color: #c7d2fe;
}

.rv-log-row-main {
    display: grid;
    grid-template-columns: 220px 1fr 36px;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: default;
}

/* Col 1 — plan_id */
.rv-log-col-plan {
    font-size: 12px;
    font-weight: 700;
    color: #1e3a5f;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Col 2 — created_at */
.rv-log-col-date {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

/* Col 3 — chevron toggle */
.rv-log-chevron-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin-left: auto;
    background: transparent;
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    color: #9ca3af;
    cursor: pointer;
    transition: background 0.13s, color 0.13s, border-color 0.13s;
}

.rv-log-chevron-btn:hover {
    background: #f3f4f6;
    color: #374151;
    border-color: #d1d5db;
}

.rv-log-chevron {
    transition: transform 0.2s ease;
    display: block;
    pointer-events: none;
}

.rv-log-chevron-btn[aria-expanded="true"] .rv-log-chevron {
    transform: rotate(180deg);
}

/* ── Detail Slot ─────────────────────────────────────────────────────────── */

.rv-log-details {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9f9f9;
    font-size: 12.5px;
    color: #374151;
    line-height: 1.6;
}

/* ── AI Agency Log — tile cursor (class stamped by JS) ───────────────────── */

.rv-log-row-main.rv-log-row-tile {
    cursor: pointer;
}

/* ── AI Agency Log — refresh button spin animation ──────────────────────── */

@keyframes rv-log-spin {
    to { transform: rotate( 360deg ); }
}

.rv-log-icon-spin svg {
    animation: rv-log-spin 0.7s linear infinite;
    transform-origin: center;
}

/* ── AI Agency Log — detail slot inner elements ──────────────────────────── */

.rv-log-details p {
    margin: 0 0 6px;
}

/* ── Report wrapper ──────────────────────────────────────────────────────── */

.rv-log-report {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Meta strip (log_type · object_id · session · cost chips) ────────────── */

.rv-log-report-meta-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.rv-log-report-meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

.rv-log-meta-type    { background: #dbeafe; color: #1e40af; }
.rv-log-meta-obj     { background: #fef3c7; color: #92400e; }
.rv-log-meta-session { background: #f0fdf4; color: #166534; }
.rv-log-meta-cost    { background: #fce7f3; color: #9d174d; }

/* ── Section block (PROMPT · HARVESTED DATA · RESPONSE · USAGE) ──────────── */

.rv-log-report-section {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.rv-log-report-section-header {
    padding: 6px 14px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #6b7280;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    font-family: 'Courier New', monospace;
}

/* ── Token Tiles (USAGE section) ─────────────────────────────────────────── */

.rv-log-token-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px;
}

.rv-log-token-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 18px;
    border-radius: 8px;
    min-width: 110px;
    flex-shrink: 0;
}

.rv-log-token-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.7;
    text-align: center;
    white-space: nowrap;
}

.rv-log-token-value {
    font-size: 22px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    line-height: 1;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

/* Token tile colour variants */
.rv-log-token-prompt     { background: #dbeafe; color: #1d4ed8; }
.rv-log-token-completion { background: #d1fae5; color: #065f46; }
.rv-log-token-total      { background: #ede9fe; color: #5b21b6; }
.rv-log-token-other      { background: #f3f4f6; color: #374151; }

/* ── Indentation — nested JSON data ──────────────────────────────────────── */

.rv-log-indent {
    padding-left: 15px;
}

/* ── JSON tree (harvested_data formatted by rv_format_log_json) ──────────── */

.rv-log-json-tree {
    background: #1e1e2e;
    padding: 10px 12px;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: auto;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

.rv-log-json-entry {
    display: block;
    line-height: 1.7;
}

.rv-log-json-key {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #888fa8;
    text-transform: none;
}

.rv-log-json-value-wrap {
    padding-left: 8px;
}

.rv-log-json-value,
.rv-log-json-scalar {
    font-family: 'Courier New', monospace;
    font-size: 11.5px;
    color: #cdd6f4;
    word-break: break-word;
}

.rv-log-json-children {
    padding-left: 0; /* depth-based padding handled inline via style attr */
}

/* Meta-chip sub-label for post ID inside the object chip */
.rv-log-meta-obj-id {
    font-size: 10px;
    opacity: 0.65;
}

/* ── Pre block — HTML variant (nl2br content, not raw text) ──────────────── */
/* Mirrors .rv-log-pre but renders <br> tags rather than preserving \n.      */

.rv-log-pre--html {
    white-space: normal;
    word-break: break-word;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

/* Preformatted content (prompt, response, serialised JSON) */
.rv-log-pre {
    margin: 0;
    padding: 10px 12px;
    background: #1e1e2e;
    color: #cdd6f4;
    font-family: 'Courier New', monospace;
    font-size: 11.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-height: 320px;
    overflow-y: auto;
    user-select: text;
    -webkit-user-select: text;
    cursor: text;
}

/* State messages */
.rv-log-loading {
    color: #6b7280;
    font-style: italic;
    margin: 0;
}

.rv-log-error {
    color: #b91c1c;
    margin: 0;
}

/* ── Quick Add Page Modal ─────────────────────────────────────────────── */

/* Tier-bar trigger button */
.rv-qa-trigger-btn {
    display:         flex;
    align-items:     center;
    gap:             5px;
    font-size:       11px;
    font-weight:     600;
    letter-spacing:  0.03em;
    color:           #e8eaf0;
    background:      rgba(255,255,255,0.10);
    border:          1px solid rgba(255,255,255,0.28);
    border-radius:   5px;
    padding:         3px 10px;
    cursor:          pointer;
    transition:      background .18s, border-color .18s;
    white-space:     nowrap;
}
.rv-qa-trigger-btn:hover {
    background:      rgba(255,255,255,0.20);
    border-color:    rgba(255,255,255,0.55);
}

/* Scroll lock */
body.rv-qa-scroll-lock { overflow: hidden; }

/* Overlay */
.rv-qa-overlay {
    position:         fixed;
    inset:            0;
    z-index:          100100;
    background:       rgba(0,0,0,0.62);
    display:          flex;
    align-items:      center;
    justify-content:  center;
    padding:          24px 16px;
}

/* Modal shell */
.rv-qa-modal {
    background:      #1e2330;
    border:          1px solid rgba(255,255,255,0.10);
    border-radius:   12px;
    box-shadow:      0 20px 60px rgba(0,0,0,0.55);
    width:           min(720px, 98vw);
    max-height:      90vh;
    display:         flex;
    flex-direction:  column;
    overflow:        hidden;
    color:           #e2e8f0;
    font-size:       13px;
}

/* Header */
.rv-qa-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             10px;
    padding:         14px 20px;
    border-bottom:   1px solid rgba(255,255,255,0.08);
    background:      rgba(255,255,255,0.03);
    flex-shrink:     0;
}
.rv-qa-header-left {
    display:         flex;
    align-items:     center;
    gap:             9px;
}
.rv-qa-header-icon {
    color:           #60a5fa;
    font-size:       15px;
    flex-shrink:     0;
}
.rv-qa-title {
    font-size:       15px;
    font-weight:     700;
    color:           #f1f5f9;
    margin:          0;
}
.rv-qa-tier-badge {
    font-size:       10px;
    font-weight:     600;
    letter-spacing:  0.06em;
    text-transform:  uppercase;
    background:      rgba(96,165,250,0.15);
    color:           #93c5fd;
    border:          1px solid rgba(96,165,250,0.30);
    border-radius:   4px;
    padding:         2px 7px;
}
.rv-qa-close {
    background:      transparent;
    border:          none;
    color:           #94a3b8;
    font-size:       20px;
    line-height:     1;
    cursor:          pointer;
    padding:         0 4px;
    transition:      color .15s;
}
.rv-qa-close:hover { color: #f1f5f9; }

/* Body */
.rv-qa-body {
    flex:            1 1 auto;
    overflow-y:      auto;
    padding:         20px;
    display:         flex;
    flex-direction:  column;
    gap:             16px;
}

/* Fields */
.rv-qa-field {
    display:         flex;
    flex-direction:  column;
    gap:             6px;
}
.rv-qa-field-row {
    display:         flex;
    gap:             14px;
}
.rv-qa-field--half {
    flex:            1;
    min-width:       0;
}
.rv-qa-field-header {
    display:         flex;
    align-items:     baseline;
    justify-content: space-between;
}
.rv-qa-label {
    font-size:       11px;
    font-weight:     600;
    letter-spacing:  0.04em;
    text-transform:  uppercase;
    color:           #94a3b8;
}
.rv-qa-required { color: #f87171; }
.rv-qa-char-count {
    font-size:       11px;
    color:           #6b7280;
    font-variant-numeric: tabular-nums;
}
.rv-qa-word-count {
    font-size:       11px;
    color:           #6b7280;
}
.rv-qa-wc--good  { color: #34d399; }
.rv-qa-wc--over  { color: #f87171; }

/* Inputs */
.rv-qa-input,
.rv-qa-textarea {
    width:           100%;
    box-sizing:      border-box;
    background:      rgba(255,255,255,0.05);
    border:          1px solid rgba(255,255,255,0.12);
    border-radius:   6px;
    color:           #e2e8f0;
    font-size:       13px;
    padding:         8px 11px;
    transition:      border-color .18s, background .18s;
    resize:          vertical;
}
.rv-qa-input:focus,
.rv-qa-textarea:focus {
    outline:         none;
    background:      rgba(255,255,255,0.08);
    border-color:    rgba(96,165,250,0.55);
    box-shadow:      0 0 0 2px rgba(96,165,250,0.15);
}
.rv-qa-input--error {
    border-color:    #f87171 !important;
    box-shadow:      0 0 0 2px rgba(248,113,113,0.15) !important;
}
.rv-qa-textarea--short { min-height: 54px; }
.rv-qa-input::placeholder,
.rv-qa-textarea::placeholder { color: #4b5563; }

/* AI action group in modal */
.rv-qa-ai-action-group {
    display:         flex;
    justify-content: flex-end;
    margin-top:      4px;
}
.rv-qa-rewrite-btn {
    display:         flex;
    align-items:     center;
    gap:             5px;
    font-size:       12px;
    font-weight:     600;
    color:           #93c5fd;
    background:      rgba(96,165,250,0.08);
    border:          1px solid rgba(96,165,250,0.25);
    border-radius:   5px;
    padding:         5px 12px;
    cursor:          pointer;
    transition:      background .18s, border-color .18s;
}
.rv-qa-rewrite-btn:hover {
    background:      rgba(96,165,250,0.15);
    border-color:    rgba(96,165,250,0.50);
}
.rv-qa-rewrite-btn:disabled {
    opacity:         0.5;
    cursor:          not-allowed;
}

/* Intent tiles */
.rv-qa-intents {
    display:         flex;
    flex-wrap:       wrap;
    gap:             7px;
}
.rv-qa-intent-option {
    display:         flex;
    align-items:     center;
    gap:             6px;
    cursor:          pointer;
    padding:         5px 10px;
    background:      rgba(255,255,255,0.04);
    border:          1px solid rgba(255,255,255,0.10);
    border-radius:   6px;
    font-size:       12px;
    font-weight:     500;
    color:           #94a3b8;
    user-select:     none;
    transition:      background .15s, border-color .15s, color .15s;
}
.rv-qa-intent-option:has(.rv-qa-intent:checked) {
    background:      rgba(96,165,250,0.12);
    border-color:    rgba(96,165,250,0.40);
    color:           #bfdbfe;
}
.rv-qa-intent { display: none; }

/* Hint bar */
.rv-qa-hint {
    display:         flex;
    align-items:     flex-start;
    gap:             8px;
    background:      rgba(96,165,250,0.07);
    border:          1px solid rgba(96,165,250,0.18);
    border-radius:   6px;
    padding:         9px 12px;
    font-size:       12px;
    color:           #93c5fd;
    line-height:     1.45;
}
.rv-qa-hint svg { flex-shrink: 0; margin-top: 1px; stroke: #60a5fa; }

/* Generated preview block */
.rv-qa-preview-fields {
    border-top:      1px solid rgba(255,255,255,0.08);
    padding-top:     16px;
    display:         flex;
    flex-direction:  column;
    gap:             14px;
}
.rv-qa-preview-header {
    display:         flex;
    align-items:     center;
    gap:             8px;
    margin-bottom:   2px;
}
.rv-qa-preview-icon  { font-size: 14px; }
.rv-qa-preview-title {
    font-size:       12px;
    font-weight:     700;
    text-transform:  uppercase;
    letter-spacing:  0.06em;
    color:           #60a5fa;
    flex:            1;
}
.rv-qa-rerun-btn {
    font-size:       11px;
    font-weight:     600;
    color:           #94a3b8;
    background:      rgba(255,255,255,0.05);
    border:          1px solid rgba(255,255,255,0.12);
    border-radius:   5px;
    padding:         3px 10px;
    cursor:          pointer;
    transition:      background .15s, color .15s;
}
.rv-qa-rerun-btn:hover { background: rgba(255,255,255,0.10); color: #e2e8f0; }
.rv-qa-rerun-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Footer */
.rv-qa-footer {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             10px;
    padding:         13px 20px;
    border-top:      1px solid rgba(255,255,255,0.08);
    background:      rgba(255,255,255,0.02);
    flex-shrink:     0;
    flex-wrap:       wrap;
}
.rv-qa-footer-status {
    font-size:       12px;
    flex:            1;
    min-width:       0;
    word-break:      break-word;
}
.rv-qa-status--success { color: #34d399; }
.rv-qa-status--success a { color: #6ee7b7; text-decoration: underline; }
.rv-qa-status--error   { color: #f87171; }

.rv-qa-footer-actions {
    display:         flex;
    gap:             8px;
    flex-shrink:     0;
}
.rv-qa-btn {
    font-size:       12px;
    font-weight:     600;
    border-radius:   6px;
    padding:         7px 16px;
    cursor:          pointer;
    border:          1px solid transparent;
    transition:      background .18s, border-color .18s, opacity .15s;
    white-space:     nowrap;
}
.rv-qa-btn:disabled { opacity: 0.40; cursor: not-allowed; }

.rv-qa-btn--cancel {
    color:           #94a3b8;
    background:      transparent;
    border-color:    rgba(255,255,255,0.15);
}
.rv-qa-btn--cancel:hover:not(:disabled) {
    background:      rgba(255,255,255,0.06);
    border-color:    rgba(255,255,255,0.28);
}
.rv-qa-btn--save {
    color:           #bfdbfe;
    background:      rgba(59,130,246,0.18);
    border-color:    rgba(59,130,246,0.40);
}
.rv-qa-btn--save:hover:not(:disabled) {
    background:      rgba(59,130,246,0.30);
    border-color:    rgba(59,130,246,0.65);
}
.rv-qa-btn--generate {
    color:           #fde68a;
    background:      rgba(217,119,6,0.20);
    border-color:    rgba(217,119,6,0.45);
}
.rv-qa-btn--generate:hover:not(:disabled) {
    background:      rgba(217,119,6,0.32);
    border-color:    rgba(217,119,6,0.70);
}

/* ── Quick Add — Generate button sparkle state ──────────────────────────── */
.rv-qa-btn--generate.rv-sparkle-spinning {
    animation:       rv-qa-gen-pulse 1.1s ease-in-out infinite;
    cursor:          wait;
    pointer-events:  none;
}
@keyframes rv-qa-gen-pulse {
    0%, 100% { opacity: 0.60; }
    50%       { opacity: 1.00; }
}

/* ── Quick Add — Success Toast ───────────────────────────────────────────── */
.rv-qa-success-toast {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    gap:             14px;
    padding:         28px 24px;
    text-align:      center;
    background:      rgba(16,185,129,0.06);
    border-top:      1px solid rgba(52,211,153,0.20);
    flex-shrink:     0;
}
.rv-qa-toast-icon {
    font-size:   28px;
    line-height: 1;
    color:       #34d399;
}
.rv-qa-toast-msg {
    font-size:   14px;
    font-weight: 600;
    color:       #34d399;
    max-width:   360px;
}
.rv-qa-toast-sub {
    font-size: 12px;
    color:     #64748b;
    max-width: 360px;
}
.rv-qa-toast-actions {
    display:         flex;
    gap:             10px;
    flex-wrap:       wrap;
    justify-content: center;
}
.rv-qa-toast-btn {
    font-size:       12px;
    font-weight:     600;
    border-radius:   6px;
    padding:         8px 18px;
    cursor:          pointer;
    border:          1px solid transparent;
    transition:      background .18s, border-color .18s, color .15s;
    white-space:     nowrap;
    text-decoration: none;
    display:         inline-block;
}
.rv-qa-toast-btn--continue {
    color:        #94a3b8;
    background:   transparent;
    border-color: rgba(255,255,255,0.15);
}
.rv-qa-toast-btn--continue:hover {
    background:   rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.28);
    color:        #e2e8f0;
}
.rv-qa-toast-btn--editor {
    color:        #a7f3d0;
    background:   rgba(52,211,153,0.15);
    border-color: rgba(52,211,153,0.40);
}
.rv-qa-toast-btn--editor:hover {
    background:   rgba(52,211,153,0.25);
    border-color: rgba(52,211,153,0.65);
}

/* ═══════════════════════════════════════════════════════════════════════════
 * SOVEREIGN ATOMIC ICON SYSTEM
 *
 * Principles:
 *   1. Initial:  Borderless, Transparent BG.
 *   2. Hover:    Inverse (BG becomes Primary, Icon becomes 90% BG tint).
 *   3. Success:  Flash Green with white checkmark.
 * ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Adjust per-theme / per-section as needed */
    --rv-icon-primary:   #444;
    --rv-bg-rgb:         255, 255, 255; /* RGB of the background (for 90% tint) */
    --rv-success-green:  #28a745;
}

.rv-icon-btn {
    position: relative;             /* required for ::after checkmark overlay */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    color: var(--rv-icon-primary);
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1;
    text-decoration: none;
    outline: none;
}

/* Override WP admin's gold focus ring with a persistent green ring */
.rv-icon-btn:focus,
.rv-icon-btn:focus-visible {
    outline: 2px solid #28a745 !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
}

/* Hover: Inversion State */
.rv-icon-btn:hover {
    background-color: var(--rv-icon-primary);
    color: rgba(var(--rv-bg-rgb), 0.9); /* Icon becomes a 90% tint of the BG */
}

/* Active Click: Slight compression for tactile feel */
.rv-icon-btn:active {
    transform: scale(0.95);
}

/* Success State: The Surgical Flash */
.rv-icon-btn.is-success {
    background-color: var(--rv-success-green) !important;
    color: #ffffff !important;
    transform: scale(1.05);
}

/* Ensure Dashicons/SVGs/FA icons inherit the color properly */
.rv-icon-btn span,
.rv-icon-btn svg,
.rv-icon-btn i {
    color: inherit;
    fill: currentColor;
    pointer-events: none; /* Prevents icon from intercepting the button click */
    transition: opacity 0.3s ease;
}

/* Surgical save crossfade — ::after carries the checkmark, hidden by default */
.rv-icon-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    color: #16a34a;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Success state: icon fades out, ✓ fades in (mirrors .rv-surgical-save-icon pattern) */
.rv-icon-btn.rv-surgical-saved {
    color: #16a34a;
}
.rv-icon-btn.rv-surgical-saved i,
.rv-icon-btn.rv-surgical-saved svg,
.rv-icon-btn.rv-surgical-saved span {
    opacity: 0;
}
.rv-icon-btn.rv-surgical-saved::after {
    content: '✓';
    opacity: 1;
}
