/* AYSA UI Core - unified visual system for all admin screens */
.aysa-admin-ui {
    --aysa-bg: #f3f6fb;
    --aysa-surface: #ffffff;
    --aysa-surface-muted: #f8fafc;
    --aysa-text: #0f172a;
    --aysa-text-muted: #475569;
    --aysa-border: #dbe3ef;
    --aysa-primary: #2563eb;
    --aysa-primary-strong: #1d4ed8;
    --aysa-success: #16a34a;
    --aysa-danger: #dc2626;
    --aysa-warning: #d97706;
    --aysa-radius: 12px;
    --aysa-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.aysa-admin-ui #wpcontent,
.aysa-admin-ui #wpbody-content {
    background: var(--aysa-bg);
}

.aysa-admin-ui .wrap {
    color: var(--aysa-text);
}

.aysa-admin-ui .wrap h1,
.aysa-admin-ui .wrap h2,
.aysa-admin-ui .wrap h3,
.aysa-admin-ui .wrap h4 {
    color: var(--aysa-text);
    letter-spacing: -0.01em;
}

.aysa-admin-ui .wrap p,
.aysa-admin-ui .wrap li,
.aysa-admin-ui .wrap label,
.aysa-admin-ui .wrap small {
    color: var(--aysa-text-muted);
}

.aysa-admin-ui .button,
.aysa-admin-ui .button-secondary,
.aysa-admin-ui .button-primary,
.aysa-admin-ui .aysa-btn,
.aysa-admin-ui [class*="aysa-"][class*="-btn"] {
    border-radius: 10px;
    transition: all .18s ease;
}

.aysa-admin-ui .button-primary,
.aysa-admin-ui .aysa-btn-primary,
.aysa-admin-ui .aysa-search-btn,
.aysa-admin-ui .aysa-refresh-data-btn,
.aysa-admin-ui .aysa-btn-blue {
    background: var(--aysa-primary);
    border-color: var(--aysa-primary);
    color: #fff;
}

.aysa-admin-ui .button-primary:hover,
.aysa-admin-ui .aysa-btn-primary:hover,
.aysa-admin-ui .aysa-search-btn:hover,
.aysa-admin-ui .aysa-refresh-data-btn:hover,
.aysa-admin-ui .aysa-btn-blue:hover {
    background: var(--aysa-primary-strong);
    border-color: var(--aysa-primary-strong);
    color: #fff;
}

.aysa-admin-ui .notice,
.aysa-admin-ui .notice.notice-success,
.aysa-admin-ui .notice.notice-error,
.aysa-admin-ui .notice.notice-warning,
.aysa-admin-ui .notice.notice-info {
    border-radius: 10px;
}

/* Cards, panels, and sections */
.aysa-admin-ui .aysa-card,
.aysa-admin-ui .aysa-metric-card,
.aysa-admin-ui .aysa-integration-card,
.aysa-admin-ui .aysa-panel,
.aysa-admin-ui .aysa-analysis-card,
.aysa-admin-ui .aysa-automation-card,
.aysa-admin-ui .aysa-completion-card,
.aysa-admin-ui .aysa-results-section,
.aysa-admin-ui .aysa-history-filters,
.aysa-admin-ui .aysa-history-table-container,
.aysa-admin-ui .aysa-cleanup-section,
.aysa-admin-ui .aysa-widget,
.aysa-admin-ui .aysa-block {
    background: var(--aysa-surface);
    border: 1px solid var(--aysa-border);
    border-radius: var(--aysa-radius);
    box-shadow: var(--aysa-shadow);
}

.aysa-admin-ui .aysa-card-header,
.aysa-admin-ui .aysa-panel-header {
    border-bottom: 1px solid var(--aysa-border);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

/* Table system */
.aysa-admin-ui table,
.aysa-admin-ui .widefat,
.aysa-admin-ui .wp-list-table {
    border-color: var(--aysa-border);
}

.aysa-admin-ui .aysa-table-wrap,
.aysa-admin-ui .aysa-table-container,
.aysa-admin-ui .aysa-table-scroll,
.aysa-admin-ui .aysa-history-table-container {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
}

.aysa-admin-ui .aysa-table-wrap thead th,
.aysa-admin-ui .aysa-table-container thead th,
.aysa-admin-ui .aysa-table-scroll thead th,
.aysa-admin-ui .wp-list-table thead th,
.aysa-admin-ui .widefat thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #eef3fb;
    color: #1e293b;
    border-bottom: 1px solid var(--aysa-border);
}

.aysa-admin-ui .widefat tbody tr:nth-child(odd),
.aysa-admin-ui .wp-list-table tbody tr:nth-child(odd),
.aysa-admin-ui .aysa-table tbody tr:nth-child(odd) {
    background: #fff;
}

.aysa-admin-ui .widefat tbody tr:nth-child(even),
.aysa-admin-ui .wp-list-table tbody tr:nth-child(even),
.aysa-admin-ui .aysa-table tbody tr:nth-child(even) {
    background: #f9fbff;
}

.aysa-admin-ui .widefat tbody tr:hover,
.aysa-admin-ui .wp-list-table tbody tr:hover,
.aysa-admin-ui .aysa-table tbody tr:hover {
    background: #edf4ff;
}

/* Tabs */
.aysa-admin-ui .nav-tab-wrapper,
.aysa-admin-ui .aysa-tabs,
.aysa-admin-ui .aysa-tab-buttons {
    border-bottom: 1px solid var(--aysa-border);
    background: var(--aysa-surface);
    border-radius: 10px 10px 0 0;
}

.aysa-admin-ui .nav-tab,
.aysa-admin-ui .aysa-tab-btn {
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    color: var(--aysa-text-muted);
    background: transparent;
}

.aysa-admin-ui .nav-tab-active,
.aysa-admin-ui .aysa-tab-btn.active {
    color: var(--aysa-primary);
    background: #eef4ff;
    border-color: var(--aysa-border);
}

/* Badges and pills */
.aysa-admin-ui .aysa-badge,
.aysa-admin-ui .badge,
.aysa-admin-ui .tag,
.aysa-admin-ui .aysa-tag {
    border-radius: 999px;
    border: 1px solid #c9d7ec;
    background: #eef5ff;
    color: #1e3a8a;
    font-weight: 600;
}

/* Inputs */
.aysa-admin-ui input[type="text"],
.aysa-admin-ui input[type="search"],
.aysa-admin-ui input[type="number"],
.aysa-admin-ui input[type="url"],
.aysa-admin-ui select,
.aysa-admin-ui textarea {
    border: 1px solid #cfd8e6;
    border-radius: 10px;
}

.aysa-admin-ui input:focus,
.aysa-admin-ui select:focus,
.aysa-admin-ui textarea:focus {
    border-color: #93b6ef;
    box-shadow: 0 0 0 1px #93b6ef;
}

/* Modal baseline */
.aysa-admin-ui .aysa-modal,
.aysa-admin-ui .aysa-error-modal,
.aysa-admin-ui .modal-overlay {
    backdrop-filter: blur(2px);
}

.aysa-admin-ui .aysa-modal-content,
.aysa-admin-ui .aysa-error-modal-content,
.aysa-admin-ui .modal-content {
    border-radius: 14px;
    border: 1px solid var(--aysa-border);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.18);
}

/* Utility helpers for frequent inline patterns */
.aysa-admin-ui .u-text-center { text-align: center; }
.aysa-admin-ui .u-mt-10 { margin-top: 10px; }
.aysa-admin-ui .u-mb-10 { margin-bottom: 10px; }
.aysa-admin-ui .u-mb-20 { margin-bottom: 20px; }
.aysa-admin-ui .u-p-20 { padding: 20px; }
.aysa-admin-ui .aysa-grid-span-full { grid-column: 1 / -1; }

/* Shared intro strip */
.aysa-admin-ui .aysa-global-intro-text {
    background-color: #e6f7ea;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    border: 1px solid #d1dde5;
    margin-bottom: 20px;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.aysa-admin-ui .aysa-eyes-img {
    width: 67px;
    height: auto;
    display: block;
    margin: 0;
    background: #e6f7ea;
}

.aysa-admin-ui .aysa-chat-message.aysa-ai-message {
    background-color: #e1f0ff;
    color: #333;
    border-bottom-left-radius: 0;
    text-align: center;
    display: inline-block;
    width: 100%;
}

.aysa-admin-ui .aysa-intro-dynamic-text {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Utility display classes */
.aysa-admin-ui .aysa-hidden {
    display: none;
}

.aysa-admin-ui .aysa-panel-login {
    max-width: 480px;
    margin: 40px auto 0 auto;
}

.aysa-admin-ui .aysa-login-required-title {
    margin-bottom: 1.5em;
    color: #dc3232;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
}

.aysa-admin-ui .aysa-td-center-padded {
    text-align: center;
    padding: 20px;
}

.aysa-admin-ui .aysa-link-danger {
    color: #dc3545;
}

.aysa-admin-ui .aysa-icon-inline {
    font-size: 14px;
    margin-right: 4px;
}

.aysa-admin-ui .aysa-icon-inline--warn { color: #d97706; }
.aysa-admin-ui .aysa-icon-inline--teal { color: #0f766e; }

.aysa-admin-ui .aysa-row-border-accent {
    border-left: 3px solid var(--aysa-primary);
}

.aysa-admin-ui .aysa-notification-inline {
    margin: 10px 0;
    position: relative;
}

.aysa-admin-ui .aysa-notification-dismiss {
    position: absolute;
    top: 0;
    right: 1px;
    padding: 9px;
    background: none;
    border: none;
    color: #72777c;
    cursor: pointer;
}

.aysa-admin-ui .aysa-bulk-actions {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid var(--aysa-border);
}

.aysa-admin-ui .aysa-bulk-actions-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.aysa-admin-ui .aysa-bulk-actions-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.aysa-admin-ui .aysa-btn-success {
    background: #46b450 !important;
    border-color: #46b450 !important;
    color: #fff !important;
}

.aysa-admin-ui .aysa-btn-danger {
    background: #dc3232 !important;
    border-color: #dc3232 !important;
    color: #fff !important;
}

.aysa-admin-ui .aysa-icon-mr-5 { margin-right: 5px; }

.aysa-admin-ui .aysa-bulk-action-status {
    margin-left: 10px;
    font-weight: 500;
    display: none;
}

.aysa-admin-ui .aysa-entity-type-badge,
.aysa-admin-ui .aysa-generator-badge,
.aysa-admin-ui .aysa-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.aysa-admin-ui .aysa-entity-type-badge--product { background: #e7f3ff; color: #0073aa; }
.aysa-admin-ui .aysa-entity-type-badge--category { background: #f0f9ff; color: #0369a1; }
.aysa-admin-ui .aysa-entity-type-badge--page { background: #f7fafc; color: #374151; }
.aysa-admin-ui .aysa-entity-type-badge--other { background: #fef7f0; color: #ea580c; }

.aysa-admin-ui .aysa-generator-badge--new { background: #dcfce7; color: #166534; }
.aysa-admin-ui .aysa-generator-badge--legacy { background: #f3f4f6; color: #374151; }

.aysa-admin-ui .aysa-status-badge--default { background: #f3f4f6; color: #374151; }
.aysa-admin-ui .aysa-status-badge--applied { background: #dcfce7; color: #166534; }
.aysa-admin-ui .aysa-status-badge--reverted { background: #fef2f2; color: #dc2626; }

/* Login */
.aysa-admin-ui .aysa-login-subnote {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.aysa-admin-ui .aysa-login-offer-box {
    margin: 0 30px 20px 30px;
    padding: 18px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 15px;
    color: #222;
}

.aysa-admin-ui .aysa-login-offer-text {
    color: #444;
    font-size: 14px;
}

.aysa-admin-ui .aysa-login-offer-line {
    display: block;
    margin-top: 8px;
}

.aysa-admin-ui .aysa-login-offer-icon {
    font-size: 18px;
    vertical-align: middle;
}

.aysa-admin-ui .aysa-login-offer-em { color: #444; }

.aysa-admin-ui .aysa-login-offer-link {
    color: #0073aa;
    text-decoration: underline;
    font-weight: 500;
}

.aysa-admin-ui .aysa-login-test-key-btn {
    margin-left: 8px;
}

.aysa-admin-ui .aysa-login-error-details {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

/* Monitoring */
.aysa-admin-ui .aysa-monitoring-table thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #f0f0f1;
    box-shadow: inset 0 -1px 0 #dcdcde;
}

.aysa-admin-ui .aysa-monitoring-legend {
    margin-top: 4px;
    color: #6b7280;
}

.aysa-admin-ui .aysa-monitoring-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    vertical-align: middle;
}

.aysa-admin-ui .aysa-monitoring-legend-dot--refreshed {
    background: #ecfdf3;
    border: 1px solid #86efac;
    margin-right: 6px;
}

.aysa-admin-ui .aysa-monitoring-legend-dot--stale {
    background: #fff1f2;
    border: 1px solid #fda4af;
    margin: 0 6px 0 14px;
}

.aysa-admin-ui .aysa-itemtype-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border: 1px solid #d0d7de;
    border-radius: 999px;
    margin: 0 4px 4px 0;
    background: #f6f8fa;
}

.aysa-admin-ui .aysa-itemtype-icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 14px;
}

.aysa-admin-ui .aysa-itemtype-label,
.aysa-admin-ui .aysa-itemtype-pill--more {
    font-size: 11px;
    line-height: 1.2;
}

.aysa-admin-ui .aysa-itemtype-pill--more {
    background: #f8fafc;
}

.aysa-admin-ui .aysa-monitoring-row-refreshed { background: #ecfdf3; }
.aysa-admin-ui .aysa-monitoring-row-stale { background: #fff1f2; }

/* Responsive safety: ensure all data tables stay within viewport */
@media (max-width: 1200px) {
    .aysa-admin-ui .widefat,
    .aysa-admin-ui .wp-list-table,
    .aysa-admin-ui .aysa-table {
        min-width: 0;
        width: 100%;
    }
}

@media screen and (max-width: 782px) {
    .aysa-admin-ui .aysa-monitoring-table thead th {
        top: 0;
    }
}

/* ---------- Global layout unification pass ---------- */
.aysa-admin-ui .wrap h1 {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    margin: 0 0 8px;
}

.aysa-admin-ui .wrap h2 {
    font-size: 26px;
    font-weight: 650;
    line-height: 1.2;
}

.aysa-admin-ui .wrap h3 {
    font-size: 21px;
    font-weight: 650;
    line-height: 1.25;
}

.aysa-admin-ui .aysa-dashboard-wrapper,
.aysa-admin-ui .aysa-admin,
.aysa-admin-ui .aysa-dashboard-container {
    background: var(--aysa-bg);
}

.aysa-admin-ui .aysa-dashboard-container,
.aysa-admin-ui .aysa-content,
.aysa-admin-ui .aysa-offpage-content,
.aysa-admin-ui .aysa-panel {
    box-sizing: border-box;
    max-width: 100%;
    width: 100%;
}

.aysa-admin-ui .aysa-page-title,
.aysa-admin-ui .aysa-dashboard-header {
    align-items: flex-start;
    background: var(--aysa-surface);
    border: 1px solid var(--aysa-border);
    border-radius: 14px;
    box-shadow: var(--aysa-shadow);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    margin: 0 0 16px;
    padding: 16px 18px;
}

.aysa-admin-ui .aysa-title-right,
.aysa-admin-ui .aysa-dashboard-user {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aysa-admin-ui .aysa-top-tabs {
    background: var(--aysa-surface);
    border: 1px solid var(--aysa-border);
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0 0 14px;
    overflow: hidden;
    padding: 0;
}

.aysa-admin-ui .aysa-tab {
    align-items: center;
    border-bottom: 2px solid transparent;
    color: #475569;
    display: inline-flex;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
    min-height: 42px;
    padding: 10px 14px;
    text-decoration: none;
    transition: all .15s ease;
}

.aysa-admin-ui .aysa-tab:hover {
    background: #f8fbff;
    color: #1e3a8a;
}

.aysa-admin-ui .aysa-tab.active {
    background: #eef4ff;
    border-bottom-color: var(--aysa-primary);
    color: var(--aysa-primary);
    font-weight: 650;
}

.aysa-admin-ui .widefat,
.aysa-admin-ui .wp-list-table,
.aysa-admin-ui .aysa-table {
    background: #fff;
    border: 1px solid var(--aysa-border);
    border-radius: 12px;
    overflow: visible;
}

.aysa-admin-ui .widefat th,
.aysa-admin-ui .widefat td,
.aysa-admin-ui .wp-list-table th,
.aysa-admin-ui .wp-list-table td {
    padding: 10px 12px;
}

.aysa-admin-ui .aysa-credits-component {
    align-items: center;
    display: inline-flex;
}

.aysa-admin-ui .aysa-credits-value {
    background: linear-gradient(135deg, #edf5ff 0%, #dbeafe 100%);
    border: 1px solid #93c5fd;
    border-radius: 10px;
    color: #1e3a8a;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 12px;
}

.aysa-admin-ui .aysa-credits-amount {
    color: #1d4ed8;
    font-weight: 800;
}

/* Normalize overly aggressive local section typography */
.aysa-admin-ui .lb-headline-row h3,
.aysa-admin-ui .lb-filters-shell h4 {
    font-size: 22px !important;
    line-height: 1.2 !important;
}

.aysa-admin-ui .lb-card h5 {
    font-size: 16px !important;
}

.aysa-admin-ui .lb-table th {
    font-size: 12px !important;
}

@media (max-width: 1200px) {
    .aysa-admin-ui .aysa-page-title,
    .aysa-admin-ui .aysa-dashboard-header {
        padding: 14px;
    }

    .aysa-admin-ui .aysa-top-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }

    .aysa-admin-ui .aysa-top-tabs .aysa-tab {
        flex: 0 0 auto;
    }
}

/* ===== AYSA Global Admin Unification Layer ===== */
.aysa-admin-ui #wpbody-content .wrap,
.aysa-admin-ui .aysa-dashboard-wrapper,
.aysa-admin-ui .aysa-dashboard-container {
    box-sizing: border-box;
    max-width: 100% !important;
    width: 100% !important;
}

/* Keep native WP admin content sizing (sidebar offset + responsive width). */
.aysa-admin-ui #wpcontent,
.aysa-admin-ui #wpbody {
    width: auto !important;
    max-width: none !important;
}

.aysa-admin-ui #wpbody-content .wrap {
    margin: 0;
    padding: 14px 16px 20px;
}

.aysa-admin-ui .aysa-dashboard-title h1,
.aysa-admin-ui .aysa-page-main-title,
.aysa-admin-ui .aysa-main-heading,
.aysa-admin-ui h1.aysa-page-title-text {
    color: #0f172a;
    font-size: 38px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.08;
    margin: 0;
}

.aysa-admin-ui .aysa-dashboard-title p,
.aysa-admin-ui .aysa-page-subtitle {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    margin: 6px 0 0;
}

.aysa-admin-ui .aysa-tabs-container,
.aysa-admin-ui .aysa-subtabs,
.aysa-admin-ui .aysa-card,
.aysa-admin-ui .aysa-panel,
.aysa-admin-ui .aysa-info-box,
.aysa-admin-ui .lb-card,
.aysa-admin-ui .lb-shell {
    background: #fff;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    box-shadow: none;
}

.aysa-admin-ui .aysa-tabs-container,
.aysa-admin-ui .aysa-panel,
.aysa-admin-ui .lb-shell {
    padding: 14px;
}

.aysa-admin-ui .aysa-tabs-nav,
.aysa-admin-ui .tab-header,
.aysa-admin-ui .lb-top-tabs {
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0 0 14px;
    padding: 0;
}

.aysa-admin-ui .aysa-tab-button,
.aysa-admin-ui .tab-button,
.aysa-admin-ui .lb-tab {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: #475569;
    cursor: pointer;
    display: inline-flex;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    margin: 0 4px 0 0;
    min-height: 42px;
    padding: 10px 12px;
    text-decoration: none;
    transition: all .15s ease;
}

.aysa-admin-ui .aysa-tab-button:hover,
.aysa-admin-ui .tab-button:hover,
.aysa-admin-ui .lb-tab:hover {
    background: #f8fbff;
    color: #1e40af;
}

.aysa-admin-ui .aysa-tab-button.active,
.aysa-admin-ui .tab-button.active,
.aysa-admin-ui .lb-tab.active {
    background: #eff6ff;
    border-bottom-color: #2563eb;
    color: #1d4ed8;
    font-weight: 700;
}

.aysa-admin-ui .button,
.aysa-admin-ui button.button {
    border-radius: 8px;
}

.aysa-admin-ui .button.button-primary,
.aysa-admin-ui .wp-core-ui .button-primary {
    background: #2563eb;
    border-color: #1d4ed8;
    box-shadow: none;
}

.aysa-admin-ui .button.button-primary:hover,
.aysa-admin-ui .wp-core-ui .button-primary:hover {
    background: #1d4ed8;
    border-color: #1e40af;
}

.aysa-admin-ui .widefat thead th,
.aysa-admin-ui .wp-list-table thead th,
.aysa-admin-ui table.dataTable thead th,
.aysa-admin-ui .lb-table thead th {
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .01em;
}

.aysa-admin-ui .widefat tbody tr:nth-child(even),
.aysa-admin-ui .wp-list-table tbody tr:nth-child(even),
.aysa-admin-ui .lb-table tbody tr:nth-child(even),
.aysa-admin-ui table.dataTable tbody tr:nth-child(even) {
    background: #fbfdff;
}

.aysa-admin-ui .widefat tbody tr:hover,
.aysa-admin-ui .wp-list-table tbody tr:hover,
.aysa-admin-ui .lb-table tbody tr:hover,
.aysa-admin-ui table.dataTable tbody tr:hover {
    background: #f0f7ff;
}

.aysa-admin-ui .notice,
.aysa-admin-ui .aysa-status-banner,
.aysa-admin-ui .lb-notice {
    border-radius: 10px;
}

.aysa-admin-ui .aysa-dashboard-container .dataTables_wrapper,
.aysa-admin-ui .lb-table-wrap,
.aysa-admin-ui .aysa-table-responsive {
    overflow-x: auto;
    width: 100%;
}

@media (max-width: 782px) {
    .aysa-admin-ui #wpbody-content .wrap {
        padding: 10px 10px 16px;
    }

    .aysa-admin-ui .aysa-dashboard-title h1,
    .aysa-admin-ui .aysa-page-main-title,
    .aysa-admin-ui .aysa-main-heading,
    .aysa-admin-ui h1.aysa-page-title-text {
        font-size: 30px;
    }
}

/* ===== Hard override layer for legacy section CSS conflicts ===== */
.aysa-admin-ui .aysa-page-title,
.aysa-admin-ui .aysa-dashboard-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
}

.aysa-admin-ui .aysa-top-tabs {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 0 !important;
    overflow: visible !important;
}

.aysa-admin-ui .aysa-top-tabs .aysa-tab {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    max-width: none !important;
    min-height: 40px !important;
    min-width: 0 !important;
    padding: 10px 14px !important;
    white-space: normal !important;
    writing-mode: horizontal-tb !important;
    transform: none !important;
}

.aysa-admin-ui .aysa-content,
.aysa-admin-ui .aysa-main-content,
.aysa-admin-ui .lb-shell,
.aysa-admin-ui .aysa-panel {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.aysa-admin-ui #wpbody-content .wrap,
.aysa-admin-ui .aysa-dashboard-wrapper,
.aysa-admin-ui .aysa-dashboard-container {
    overflow-x: auto;
}

/* Hard containment so no section can push page width beyond viewport */
.aysa-admin-ui #wpwrap,
.aysa-admin-ui #wpcontent,
.aysa-admin-ui #wpbody,
.aysa-admin-ui #wpbody-content,
.aysa-admin-ui #wpbody-content .wrap,
.aysa-admin-ui .aysa-admin,
.aysa-admin-ui .aysa-dashboard-wrapper,
.aysa-admin-ui .aysa-dashboard-container,
.aysa-admin-ui .aysa-content,
.aysa-admin-ui .aysa-main-content {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.aysa-admin-ui #wpcontent,
.aysa-admin-ui #wpbody-content,
.aysa-admin-ui #wpbody-content .wrap,
.aysa-admin-ui .aysa-admin,
.aysa-admin-ui .aysa-dashboard-wrapper,
.aysa-admin-ui .aysa-dashboard-container,
.aysa-admin-ui .aysa-content,
.aysa-admin-ui .aysa-main-content {
    overflow-x: visible !important;
}

/* Legacy layout reset (old sidebar shell can create global horizontal overflow) */
.aysa-admin-ui .aysa-sidebar {
    position: static !important;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    border-right: 0 !important;
    padding: 0 !important;
}

.aysa-admin-ui .aysa-main {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
}

/* Bootstrap rows from legacy tabs may overflow via negative margins */
.aysa-admin-ui .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.aysa-admin-ui .aysa-table-wrap,
.aysa-admin-ui .aysa-table-container,
.aysa-admin-ui .aysa-table-responsive,
.aysa-admin-ui .dataTables_wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
}

.aysa-admin-ui table td,
.aysa-admin-ui table th {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.aysa-admin-ui .widefat thead th,
.aysa-admin-ui .wp-list-table thead th,
.aysa-admin-ui .aysa-table thead th,
.aysa-admin-ui table.dataTable thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 15 !important;
    background: #f8fafc !important;
}

/* ===== Full plugin visual consistency pass ===== */
.aysa-admin-ui .aysa-admin {
    display: block !important;
    min-height: 0 !important;
    background: transparent !important;
}

.aysa-admin-ui .aysa-page-title {
    margin: 0 0 14px !important;
    padding: 0 !important;
}

.aysa-admin-ui .aysa-page-title h1 {
    margin: 0 !important;
    font-size: 34px !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
    letter-spacing: -0.02em !important;
}

.aysa-admin-ui .aysa-admin .aysa-page-title h1,
.aysa-admin-ui .aysa-admin .aysa-dashboard-title h1,
.aysa-admin-ui .aysa-dashboard-wrapper .aysa-dashboard-title h1 {
    font-size: 34px !important;
    font-weight: 800 !important;
    line-height: 1.15 !important;
    letter-spacing: -0.02em !important;
}

.aysa-admin-ui .aysa-title-right,
.aysa-admin-ui .aysa-header-right {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
}

.aysa-admin-ui .aysa-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.aysa-admin-ui .aysa-top-tabs {
    margin: 0 0 14px !important;
    padding: 4px !important;
    border: 1px solid var(--aysa-border) !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: none !important;
}

.aysa-admin-ui .aysa-top-tabs .aysa-tab {
    border-radius: 8px !important;
    border: 1px solid transparent !important;
    color: #334155 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}

.aysa-admin-ui .aysa-top-tabs .aysa-tab.active {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    border-color: #bfdbfe !important;
}

.aysa-admin-ui .aysa-top-tabs .aysa-tab:hover {
    background: #f8fbff !important;
    color: #1d4ed8 !important;
}

.aysa-admin-ui .aysa-panel,
.aysa-admin-ui .aysa-card,
.aysa-admin-ui .aysa-results-section,
.aysa-admin-ui .aysa-results-panel,
.aysa-admin-ui .aysa-overlap-panel,
.aysa-admin-ui .aysa-seed-overview,
.aysa-admin-ui .aysa-missing-pages-shell,
.aysa-admin-ui .aysa-content-strategy-dashboard {
    border-radius: 12px !important;
}

.aysa-admin-ui .aysa-credits-component {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 12px !important;
    border: 1px solid #bfdbfe !important;
    border-radius: 12px !important;
    background: #eff6ff !important;
}

.aysa-admin-ui .aysa-credits-value {
    color: #1e293b !important;
    font-size: 14px !important;
    font-weight: 700 !important;
}

.aysa-admin-ui .aysa-credits-amount {
    color: #1d4ed8 !important;
    font-weight: 800 !important;
    min-width: 36px !important;
    display: inline-block !important;
    text-align: right !important;
}

.aysa-admin-ui .widefat,
.aysa-admin-ui .wp-list-table,
.aysa-admin-ui .aysa-keywords-table,
.aysa-admin-ui .aysa-seed-table,
.aysa-admin-ui .aysa-competitor-table,
.aysa-admin-ui .aysa-monitoring-table {
    width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.aysa-admin-ui .widefat thead th,
.aysa-admin-ui .wp-list-table thead th,
.aysa-admin-ui .aysa-keywords-table thead th,
.aysa-admin-ui .aysa-seed-table thead th,
.aysa-admin-ui .aysa-competitor-table thead th,
.aysa-admin-ui .aysa-monitoring-table thead th {
    top: 0 !important;
    background: #f1f5f9 !important;
    border-bottom: 1px solid #dbe3ef !important;
}

.aysa-admin-ui table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 15 !important;
    background: #f1f5f9 !important;
}

.aysa-admin-ui .widefat tbody td,
.aysa-admin-ui .wp-list-table tbody td,
.aysa-admin-ui .aysa-keywords-table tbody td,
.aysa-admin-ui .aysa-seed-table tbody td,
.aysa-admin-ui .aysa-competitor-table tbody td,
.aysa-admin-ui .aysa-monitoring-table tbody td {
    border-bottom: 1px solid #e5ecf5 !important;
    vertical-align: top !important;
}

@media (max-width: 1200px) {
    .aysa-admin-ui .aysa-top-tabs {
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
    }

    .aysa-admin-ui .aysa-top-tabs .aysa-tab {
        flex: 0 0 auto !important;
    }
}

@media (max-width: 782px) {
    .aysa-admin-ui .aysa-page-title h1 {
        font-size: 28px !important;
    }

    .aysa-admin-ui .aysa-credits-component {
        width: 100% !important;
        justify-content: space-between !important;
    }
}

/* Fallback selectors when .aysa-admin-ui is missing from wrapper/body on some screens */
body[class*="page_aysa"] #wpcontent,
body[class*="page_aysa"] #wpbody-content,
body[class*="page_aysa"] #wpbody-content .wrap {
    max-width: 100% !important;
    overflow-x: visible !important;
    box-sizing: border-box !important;
}

body[class*="page_aysa"] .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

body[class*="page_aysa"] .widefat,
body[class*="page_aysa"] .wp-list-table,
body[class*="page_aysa"] .aysa-table {
    width: 100% !important;
    max-width: 100% !important;
}

body[class*="page_aysa"] table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 15 !important;
    background: #f1f5f9 !important;
}

body[class*="page_aysa"] .aysa-table-wrap,
body[class*="page_aysa"] .aysa-table-container,
body[class*="page_aysa"] .aysa-table-responsive,
body[class*="page_aysa"] .dataTables_wrapper {
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
}

.aysa-admin-ui .aysa-sticky-grid-wrap,
body[class*="page_aysa"] .aysa-sticky-grid-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.aysa-admin-ui .aysa-sticky-grid-head,
.aysa-admin-ui .aysa-sticky-grid-head > * {
    position: sticky;
    top: 0;
    z-index: 15;
    background: #f1f5f9;
}
