html.plagscanx-app-active,
body.plagscanx-app-active {
    height: 100% !important;
    margin: 0 !important;
    overflow: hidden !important;
}

html.plagscanx-app-active {
    margin-top: 0 !important;
}

body.plagscanx-app-active {
    padding-top: 0 !important;
}

body.plagscanx-app-active #wpadminbar,
body.plagscanx-app-active #masthead,
body.plagscanx-app-active #colophon,
body.plagscanx-app-active .site-header,
body.plagscanx-app-active .site-footer,
body.plagscanx-app-active .wp-site-blocks > header,
body.plagscanx-app-active .wp-site-blocks > footer,
body.plagscanx-app-active #page > header,
body.plagscanx-app-active #page > footer,
body.plagscanx-app-active header.wp-block-template-part,
body.plagscanx-app-active footer.wp-block-template-part {
    display: none !important;
}

:root {
    --psx-surface: #ffffff;
    --psx-surface-muted: #f8fafc;
    --psx-surface-soft: #f1f5f9;
    --psx-border: #e2e8f0;
    --psx-border-strong: #cbd5e1;
    --psx-text-strong: var(--psx-text, #1e293b);
    --psx-success: #16a34a;
    --psx-danger: #dc2626;
    --psx-warning: #d97706;
    --psx-info: var(--psx-link, #2563eb);
    --psx-disabled-bg: #e2e8f0;
    --psx-disabled-border: #cbd5e1;
    --psx-disabled-foreground: #475569;
    --psx-radius-control: 6px;
    --psx-radius-card: 8px;
    --psx-shadow-soft: 0 1px 3px rgba(15, 23, 42, 0.06);
    --psx-shadow-hover: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.psx-text-muted {
    color: var(--psx-text-muted);
}

.psx-text-success {
    color: var(--psx-success);
}

.psx-text-danger {
    color: var(--psx-danger);
}

.psx-inline-state {
    margin: 0;
    padding: 20px;
    text-align: center;
    color: var(--psx-text-muted);
}

.psx-inline-state.is-empty {
    padding: 30px 0;
    font-size: 13px;
}

.psx-inline-state.is-success {
    color: var(--psx-success);
}

.psx-inline-state.is-error {
    color: var(--psx-danger);
}

.psx-tool-error {
    margin: 0;
    color: var(--psx-danger);
}

.plagscanx-app-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    background: #fff;
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: inherit;
    overflow: hidden;
}

.plagscanx-app-overlay * {
    box-sizing: border-box;
}

.plagscanx-app-container {
    display: flex;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    background: #fff;
    overflow: hidden;
}

/* Sidebar Left */
.plagscanx-sidebar-left {
    width: 270px;
    flex-shrink: 0;
    border-right: 1px solid #f0f0f1;
    background: var(--psx-sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: width 180ms ease;
}

.plagscanx-brand {
    min-height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid #f9f9f9;
    margin-bottom: 5px;
    gap: 8px;
}

.plagscanx-brand-full {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.plagscanx-brand-icon {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    color: var(--psx-primary);
}

.plagscanx-brand .plagscanx-brand-icon img {
    display: block;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
}

.plagscanx-brand-icon .psx-icon {
    width: 20px;
    height: 20px;
}

.plagscanx-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--psx-text-muted);
    cursor: pointer;
    transition: background-color 120ms ease, color 120ms ease;
}

.plagscanx-sidebar-toggle:hover {
    background: rgba(127, 127, 127, 0.12);
    color: var(--psx-text);
}

.plagscanx-sidebar-toggle:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--psx-primary) 24%, transparent);
}

.plagscanx-sidebar-toggle .psx-icon {
    width: 16px;
    height: 16px;
}

.plagscanx-brand h2 {
    margin: 0;
    font-size: 20px;
    color: var(--psx-text);
    font-weight: 700;
}

.plagscanx-brand img {
    width: var(--psx-brand-logo-width, 150px);
    max-width: 100%;
    height: auto;
}

.plagscanx-nav-section {
    padding: 0px 10px 10px 10px;
    line-height: 28px;
}

.nav-section-title {
    margin: 0 0 0 24px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--psx-text-muted);
    letter-spacing: 0.5px;
}

.plagscanx-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    padding-inline-start: 0 !important;
}

.plagscanx-nav li {
    padding: 3px 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--psx-text);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-radius: 8px;
    margin: 2px 8px;
}

.plagscanx-nav li.active {
    background: #f0f4f8;
    color: var(--psx-text);
}

.plagscanx-nav li:hover:not(.active):not(.disabled) {
    background: #f9f9f9;
}

.plagscanx-nav li .dashicons {
    margin-right: 12px;
    font-size: 18px;
    color: var(--psx-text-muted);
}

.plagscanx-nav li.active .dashicons {
    color: var(--psx-link);
}

/* Sidebar Footer (Sticky Bottom) */
.plagscanx-sidebar-footer {
    margin-top: auto;
    border-top: 1px solid #f0f0f1;
    background: var(--psx-sidebar-bg);
}

/* Upgrade & Consumption */
.plagscanx-upgrade-box {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 4px;
    margin: 15px;
    text-decoration: none;
    color: var(--psx-text);
    font-weight: 500;
    gap: 10px;
    transition: box-shadow 0.2s;
    box-shadow: none;
}

.plagscanx-upgrade-box:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.upgrade-icon {
    font-size: 18px;
}

.plagscanx-consumption-card {
    background: #f7f7f7;
    border-radius: 12px;
    padding: 16px;
    margin: 15px;
}

.consumption-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.consumption-card-header .usage-title {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--psx-text);
}

.consumption-card-header .badge,
.simple-usage-header .badge {
    background: rgba(77, 97, 252, 0.1);
    color: var(--psx-primary);
    padding: 0px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
    line-height: 24px;
}

.consumption-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.consumption-header .label {
    font-size: 14px;
    color: var(--psx-text);
    font-weight: 500;
}

.consumption-header .value {
    font-size: 14px;
    color: var(--psx-text-muted);
    font-weight: 400;
}

.plagscanx-progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.plagscanx-progress-fill.premium {
    background: var(--psx-primary);
}

/* Dynamic Usage Colors */
.plagscanx-progress-fill.usage-low {
    background: var(--psx-success);
    /* Green: 0-50% */
}

.plagscanx-progress-fill.usage-medium {
    background: var(--psx-warning);
    /* Amber: 50-80% */
}

.plagscanx-progress-fill.usage-high {
    background: var(--psx-danger);
    /* Red: 80%+ */
}

/* User Profile Section */
.plagscanx-profile-section {
    position: relative;
    padding: 10px 16px;
    margin-top: auto;
}

.plagscanx-user-card {
    display: flex;
    align-items: center;
    background: #f7f7f7;
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s;
    gap: 12px;
}

.plagscanx-user-card:hover {
    background: #efefef;
}

/* PlagScanX Notifications & Errors */

/* Toast Container */
.plagscanx-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

/* Toast Item */
.plagscanx-toast {
    background: #fff;
    border-left: 4px solid #333;
    padding: 12px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--psx-text);
    min-width: 250px;
    max-width: 350px;
    animation: plagscanx-slide-in 0.3s ease-out forwards;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(20px);
}

.plagscanx-toast.show {
    opacity: 1;
    transform: translateX(0);
}

.plagscanx-toast.hide {
    animation: plagscanx-slide-out 0.3s ease-in forwards;
}

/* Toast Variants */
.plagscanx-toast.success {
    border-left-color: var(--psx-success);
}

.plagscanx-toast.success .dashicons,
.plagscanx-toast.success .psx-icon {
    color: var(--psx-success);
}

.plagscanx-toast.error {
    border-left-color: var(--psx-danger);
}

.plagscanx-toast.error .dashicons,
.plagscanx-toast.error .psx-icon {
    color: var(--psx-danger);
}

.plagscanx-toast.info {
    border-left-color: var(--psx-info);
}

.plagscanx-toast.info .dashicons,
.plagscanx-toast.info .psx-icon {
    color: var(--psx-info);
}

.plagscanx-toast.warning {
    border-left-color: var(--psx-warning);
}

.plagscanx-toast.warning .dashicons,
.plagscanx-toast.warning .psx-icon {
    color: var(--psx-warning);
}

/* Keyframes */
@keyframes plagscanx-slide-in {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes plagscanx-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(30px);
    }
}

/* Standardized Inline Error Box */
.plagscanx-error {
    background: #fff5f5;
    border: 1px solid #ffcccc;
    border-left: 4px solid var(--psx-danger);
    color: #c0392b;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 13px;
    margin-top: 10px;
    display: none;
    line-height: 1.4;
}


/* Empty States */
.rw-state-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: #fdfdfd;
    border-radius: 8px;
    min-height: 200px;
    color: var(--psx-text-muted);
}

.rw-state-box p {
    margin: 10px 0 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--psx-text);
}

.rw-state-box p.sub {
    font-size: 13px;
    font-weight: 400;
    color: var(--psx-text-muted);
    margin-top: 5px;
}

.rw-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--psx-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.plagscanx-user-card .user-avatar img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

.plagscanx-user-card .user-meta {
    flex: 1;
    min-width: 0;
    line-height: 20px;
}

.plagscanx-user-card .user-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--psx-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plagscanx-user-card .user-email {
    font-size: 12px;
    color: var(--psx-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plagscanx-user-card .dashicons-unfold {
    font-size: 16px;
    color: var(--psx-text);
}

/* Profile Menu Popup */
.plagscanx-profile-menu {
    position: absolute;
    bottom: 100%;
    left: 16px;
    right: 16px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #f0f0f0;
    margin-bottom: 12px;
    z-index: 1000;
    padding: 8px;
}

.profile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.profile-menu-list li a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: var(--psx-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    gap: 12px;
    transition: background 0.2s;
}

.profile-menu-list li a:hover {
    background: #f7f7f7;
}

.profile-menu-list li a .dashicons {
    font-size: 18px;
    color: var(--psx-text-muted);
}

.profile-menu-list .menu-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 4px 0;
}

.profile-menu-list a.logout-item {
    color: var(--psx-text);
}

.plagscanx-app-header {
    position: relative;
    justify-content: flex-start;
    gap: 12px;
    z-index: 100;
}

.plagscanx-app-header .header-left {
    min-width: 0;
    margin-inline-end: auto;
}

.plagscanx-app-header .psx-app-profile {
    position: relative;
    z-index: 1200;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 0;
}

.plagscanx-app-header .psx-app-profile-trigger {
    display: grid;
    place-items: center;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    margin: 0;
    padding: 2px;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    line-height: 0;
}

.plagscanx-app-header .psx-app-profile-trigger:hover,
.plagscanx-app-header .psx-app-profile-trigger.open {
    border-color: var(--psx-border, #e4e4e7);
    background: var(--psx-muted, #f4f4f5);
}

.plagscanx-app-header .psx-app-profile-trigger:focus-visible {
    outline: 2px solid var(--psx-primary, #4f46e5);
    outline-offset: 2px;
}

.plagscanx-app-header .psx-app-profile-trigger .user-avatar,
.plagscanx-app-header .psx-app-profile-trigger .user-avatar img {
    display: block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.plagscanx-app-header .psx-app-profile-trigger .user-avatar img {
    object-fit: cover;
}

.plagscanx-app-header .psx-app-profile .plagscanx-profile-menu {
    top: calc(100% + 7px);
    right: 0;
    bottom: auto;
    left: auto;
    width: min(288px, calc(100vw - 32px));
    max-height: min(520px, calc(100dvh - 96px));
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.psx-profile-menu-identity {
    min-width: 0;
    margin: 0 4px 4px;
    padding: 10px 8px 12px;
    border-bottom: 1px solid var(--psx-border, #e4e4e7);
}

.psx-profile-menu-name,
.psx-profile-menu-email {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.psx-profile-menu-name {
    color: var(--psx-text, #18181b);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.psx-profile-menu-email {
    margin-top: 2px;
    color: var(--psx-text-muted, #71717a);
    font-size: 12px;
    line-height: 18px;
}

@media (min-width: 901px) {
    html.plagscanx-sidebar-collapsed .plagscanx-sidebar-left {
        position: relative;
        z-index: 101;
        width: 72px;
        overflow: visible;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-brand {
        position: relative;
        justify-content: center;
        padding-right: 0;
        padding-left: 0;
        gap: 0;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-brand-full {
        display: none;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-brand-icon {
        display: inline-flex;
        flex: 0 0 24px;
        margin: 0;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-sidebar-toggle {
        position: absolute;
        z-index: 2;
        top: 50%;
        right: -16px;
        flex: none;
        margin: 0;
        background: var(--psx-background);
        transform: translateY(-50%);
    }

    html.plagscanx-sidebar-collapsed .plagscanx-nav-section {
        padding-right: 8px;
        padding-left: 8px;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-nav li {
        position: relative;
        justify-content: center;
        width: 100%;
        margin-right: 0;
        margin-left: 0;
        padding-right: 8px;
        padding-left: 8px;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-nav li > span {
        display: none;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-nav li .psx-crown-icon {
        position: absolute;
        top: 4px;
        right: 4px;
        width: 10px;
        height: 10px;
        margin: 0 !important;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-nav-divider {
        margin-right: 8px;
        margin-left: 8px;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-usage-widget {
        gap: 0;
        margin: 4px 8px 8px;
        padding: 0;
        border-radius: 0;
        background: transparent;
    }

    html.plagscanx-sidebar-collapsed .simple-usage-wrapper {
        display: none;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-sidebar-left .plagscanx-upgrade-box {
        width: 36px;
        min-width: 36px;
        height: 36px;
        min-height: 36px;
        margin: 0 auto;
        padding: 0;
        gap: 0;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-sidebar-left .plagscanx-upgrade-box > span:not(.upgrade-icon) {
        display: none;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-sidebar-left .plagscanx-profile-section {
        padding: 8px;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-sidebar-left .plagscanx-user-card {
        justify-content: center;
        min-height: 48px;
        padding: 5px;
        gap: 0;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-sidebar-left .plagscanx-user-card .user-meta,
    html.plagscanx-sidebar-collapsed .plagscanx-sidebar-left .plagscanx-user-card > .psx-icon {
        display: none;
    }

    html.plagscanx-sidebar-collapsed .plagscanx-sidebar-left .plagscanx-profile-menu {
        right: auto;
        bottom: 0;
        left: calc(100% + 8px);
        width: 232px;
        margin-bottom: 0;
    }
}

@media (max-width: 900px) {
    .plagscanx-app-header .psx-app-profile {
        display: none;
    }
}

/* App Header */
.plagscanx-app-header {
    min-height: 48px;
    box-sizing: border-box;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 5px 24px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-left .dashicons-columns {
    color: var(--psx-text);
}

.header-left h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--psx-text);
}

.header-info-icon {
    font-size: 16px;
    color: #ccc;
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-tool-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: #eee;
}

.header-action-btn,
.header-share-btn {
    padding: 0;
    /* Let secondary class handle it */
    white-space: nowrap;
}

.header-action-btn .dashicons,
.header-share-btn .dashicons {
    font-size: 18px;
}

/* Toggle Switch */
.plagscanx-toggle-container {
    position: relative;
    display: inline-block;
    flex: 0 0 auto;
    width: 30px;
    height: 18px;
    margin: 0 !important;
    /* Reset theme margins */
}

.plagscanx-toggle-container input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #eee;
    border: 2px solid transparent;
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 0;
    top: 0;
    bottom: auto;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--psx-primary);
}

input:checked+.toggle-slider:before {
    transform: translateX(12px);
}

.toggle-label {
    font-size: 13px;
    color: var(--psx-text-muted);
    font-weight: 500;
    margin: 0 !important;
    /* Reset theme margins */
}

.usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.plagscanx-usage-widget h4 {
    margin: 0;
    font-size: 13px;
    color: var(--psx-text);
    font-weight: 600;
}

.tier-label {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.tier-label.free {
    background: #f0f0f0;
    color: var(--psx-text-muted);
}

.tier-label.basic {
    background: #e3f2fd;
    color: #1976d2;
}

.tier-label.pro {
    background: #e8f5e9;
    color: #2e7d32;
}

.tier-label.business {
    background: #fff3e0;
    color: #f57c00;
}

/* Profile & Actions */
.plagscanx-user-profile-wrapper {
    padding: 16px 24px;
}

.plagscanx-user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.plagscanx-profile-actions {
    border-top: 1px solid #f9f9f9;
    padding-top: 10px;
}

.plagscanx-logout-link {
    display: flex;
    align-items: center;
    color: var(--psx-danger);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s;
}

.plagscanx-logout-link:hover {
    opacity: 0.8;
}

.plagscanx-logout-link .dashicons {
    margin-right: 8px;
    font-size: 16px;
}

/* Consumption Elements (Merged) */
.usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.plagscanx-usage-text {
    display: none;
    /* Replaced by bucket labels */
}

.plagscanx-upgrade-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background: #111;
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    gap: 8px;
    transition: background 0.2s;
}

.plagscanx-upgrade-btn:hover {
    background: #333;
}

.plagscanx-upgrade-btn .dashicons {
    font-size: 16px;
    color: #fff;
}

.user-avatar img {
    border-radius: 50%;
    width: 36px;
    height: 36px;
    object-fit: cover;
}

.user-info {
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--psx-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: var(--psx-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Main Content / Editor */
.plagscanx-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--psx-main-bg);
    position: relative;
    overflow: hidden;
    height: 100%;
}

#plagscanx-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    /* Remove height: 100% to allow flex logic to work with header */
}

.plagscanx-view {
    display: none;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    /* Default to clipped */
}

#view-settings,
#view-history {
    overflow-y: auto;
}

.plagscanx-view.active {
    display: flex;
}

.plagscanx-editor-container {
    flex: 1;
    /* Takes all available space pushing footer down */
    padding: 20px 30px 0 30px;
    overflow-y: auto;
    /* Enable scroll here for editor */
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
    /* Gap from toolbar */
}

#view-text .plagscanx-editor-container,
#view-ai_detect .plagscanx-editor-container {
    padding-bottom: 20px;
    margin-bottom: 0;
}

.plagscanx-input-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    flex: 1;
    /* Takes full height of container */
    min-height: 500px;
    /* User Request: Force height to test */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

#plagscanx-text,
#plagscanx-ai-text,
#psx-new-text {
    flex: 1;
    min-height: 0;
    width: 100%;
    height: auto;
    border: none;
    resize: none;
    font-size: 16px;
    line-height: 1.6;
    color: var(--psx-text);
    padding: 30px;
    outline: none;
    box-sizing: border-box;
    overflow-y: auto;
    /* Input box IS scrollable */
}

/* Toolbar */
.plagscanx-editor-toolbar {
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 5;
    flex-shrink: 0;
}

.hidden-file-input {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    z-index: -1 !important;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.toolbar-item {
    display: flex;
    align-items: center;
}

.toolbar-left .counter-item {
    white-space: nowrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.toolbar-right .plagscanx-cta-tooltip-wrap {
    flex-shrink: 0;
}

.counter-item {
    font-size: 13px;
    color: var(--psx-text-muted);
    font-weight: 500;
}

.plagscanx-btn-upload {
    background: #fff;
    border: 1px solid #ddd;
    color: var(--psx-text);
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    /* Ensure no text wrap */
    white-space: nowrap;
}


.plagscanx-btn-upload:hover {
    border-color: #bbb;
    background: #fff;
}


.plagscanx-btn-secondary {
    background: #fff;
    border: 1px solid #ddd;
    color: var(--psx-text);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.plagscanx-btn-secondary:hover {
    border-color: #bbb;
    background: #f9f9f9;
}

/* Specific overrides for buttons in sidebars or full-width context */
#btn-rescan.plagscanx-btn-secondary,
#btn-ai-rescan.plagscanx-btn-secondary {
    width: 100%;
    margin-top: 20px;
    padding: 10px 24px;
    font-size: 14px;
}

.history-container {
    padding: 40px;
}


/* Right Sidebar Results */
.plagscanx-sidebar-right {
    width: 340px;
    flex-shrink: 0;
    border-left: 1px solid #f0f0f1;
    background: var(--psx-sidebar-bg);
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

:is(#plagscanx-results, .psx-plagiarism-report),
:is(#ai-results, .psx-ai-report) {
    padding: 24px;
}

.results-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ddd;
    margin-top: 15vh;
    padding: 20px;
}

.results-empty-state p {
    margin: 10px 0 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--psx-text-muted);
}

.psx-empty-icon {
    width: 48px;
    height: 48px;
    color: var(--psx-border-strong);
}

.results-empty-state p.sub {
    font-size: 13px;
    font-weight: 400;
    color: var(--psx-text-muted);
    margin-top: 5px;
}

/* Result Typography Fixes */
.score-header {
    text-align: center;
    margin-bottom: 30px;
}

.big-score {
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
    color: var(--psx-text);
    margin-bottom: 8px;
}

.score-label-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.score-label {
    font-size: 13px;
    color: var(--psx-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.risk-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--psx-text);
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 12px;
}

.plagscanx-progress-bars {
    margin-bottom: 30px;
}

.bar-row {
    margin-bottom: 12px;
}

.bar-row .label {
    font-size: 13px;
    color: var(--psx-text);
    display: inline-flex;
    align-items: center;
}

.bar-row .val {
    float: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--psx-text);
}

.sources-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #f0f0f1;
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.sources-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--psx-text);
}

.sources-header .badge {
    font-size: 14px;
    color: var(--psx-text-muted);
    font-weight: 400;
}

.result-item {
    background: #fff;
    border-bottom: 1px solid #f0f0f1;
    padding: 16px 0;
    margin-bottom: 0;
    box-shadow: none;
}

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

.result-item h4 {
    margin: 0 0 6px;
    font-size: 15px;
    line-height: 1.4;
    font-weight: 600;
}

.result-item h4 a {
    color: var(--psx-text);
    text-decoration: none;
    transition: color 0.1s;
}

.result-item h4 a:hover {
    color: var(--psx-link);
}

.result-item .meta {
    font-size: 12px;
    color: var(--psx-text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-item .match-badge {
    color: var(--psx-danger);
    font-weight: 500;
}

.result-item .snippet {
    font-size: 13px;
    line-height: 1.5;
    color: var(--psx-text-muted);
    font-style: normal;
}



/* Smart Loading UI */
.plagscanx-step-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px;
}

.step-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 10px;
    background: #fff;
    /* or transparent */
    border-radius: 8px;
    transition: all 0.3s;
    font-size: 14px;
    color: var(--psx-text);
    font-weight: 500;
}

.step-item.active {
    background: #f8fcfd;
    color: var(--psx-text);
}

.step-item.pending {
    opacity: 0.5;
}

.step-icon {
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    background: #eee;
    color: var(--psx-text-muted);
    font-size: 12px;
    margin-right: 12px;
    flex-shrink: 0;
}

.step-item.active .step-icon {
    background: transparent;
    border: 2px solid var(--psx-link);
    /* Spinner or circle? */
    color: var(--psx-link);
    /* Simulate spinner with border */
    border-top-color: transparent;
    animation: step-spin 1s linear infinite;
}

.step-item.done .step-icon {
    background: #e6f9ed;
    color: var(--psx-success);
    animation: none;
    border: none;
}

.step-item.done .step-icon .dashicons {
    font-size: 16px;
}

@keyframes step-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.plagscanx-scan-progress-bar {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.plagscanx-scan-progress-bar .progress-fill {
    height: 100%;
    background: var(--psx-link);
    width: 0%;
    transition: width 0.3s linear;
}

.progress-info {
    text-align: center;
    font-size: 12px;
    color: var(--psx-text-muted);
}

.psx-scan-loading {
    padding: 24px 30px 30px;
    text-align: center;
}

.psx-scanner-stage {
    position: relative;
    width: min(100%, 328px);
    margin: 0 auto 10px;
    overflow: hidden;
}

.psx-ai-scan-loading .psx-scanner-stage {
    aspect-ratio: 328 / 208;
}

.psx-plagiarism-scan-loading .psx-scanner-stage {
    aspect-ratio: 5 / 3;
}

.psx-scanner-animation,
.psx-scanner-fallback {
    position: absolute;
    inset: 0;
}

.psx-scanner-animation {
    opacity: 0;
    transition: opacity 160ms ease;
}

.psx-scanner-animation svg {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.psx-scanner-fallback {
    display: grid;
    place-items: center;
    color: var(--psx-primary);
    opacity: 1;
    transition: opacity 160ms ease, visibility 160ms ease;
}

.psx-scanner-fallback .psx-icon {
    width: 54px;
    height: 54px;
    animation: psx-scanner-pulse 1.4s ease-in-out infinite;
}

.psx-scan-loading.is-animation-ready .psx-scanner-animation {
    opacity: 1;
}

.psx-scan-loading.is-animation-ready .psx-scanner-fallback {
    visibility: hidden;
    opacity: 0;
}

.psx-loading-title {
    margin: 0 0 7px;
    color: var(--psx-text);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
}

.psx-loading-status {
    min-height: 20px;
    margin: 0 0 18px;
    color: var(--psx-text-muted);
    font-size: 14px;
    line-height: 1.45;
}

.psx-scan-loading .plagscanx-scan-progress-bar {
    width: min(100%, 328px);
    margin: 0 auto 10px;
}

.psx-scan-loading .progress-info {
    margin: 0;
}

@keyframes psx-scanner-pulse {
    0%,
    100% {
        opacity: 0.45;
        transform: scale(0.94);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .psx-scanner-animation {
        display: none;
    }

    .psx-scan-loading.is-animation-ready .psx-scanner-fallback,
    .psx-scanner-fallback {
        visibility: visible;
        opacity: 1;
    }

    .psx-scanner-fallback .psx-icon {
        animation: none;
    }
}

@media (max-width: 767px) {
    .psx-scan-loading {
        padding: 20px;
    }

    .psx-scanner-stage {
        width: min(100%, 280px);
    }
}

/* History Cards */
.history-container h3 {
    margin-bottom: 24px;
    font-size: 20px;
    color: var(--psx-text);
}

.plagscanx-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.history-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.history-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.06);
    border-color: #d0d0d0;
}

.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.history-score-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 0 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.history-date {
    font-size: 11px;
    color: var(--psx-text-muted);
    font-weight: 500;
}

.history-snippet {
    font-size: 13px;
    line-height: 1.5;
    color: var(--psx-text-muted);
    margin-bottom: 16px;
    flex: 1;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
}

.history-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f0f0f0;
    padding-top: 16px;
    margin-top: auto;
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-see-report {
    background: transparent;
    color: var(--psx-link);
    border: 1px solid var(--psx-link);
    padding: 0px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-see-report:hover {
    background: var(--psx-link);
    color: #fff;
}

.btn-share-report,
.btn-delete-card {
    background: transparent;
    border: none;
    color: var(--psx-text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    transition: color 0.2s;
}

.btn-share-report:hover {
    color: var(--psx-link);
}

.btn-delete-card:hover {
    color: var(--psx-danger);
}

/* Settings View Styles */
.settings-container {
    padding: 40px;
    max-width: 900px;
}

.settings-header-box {
    margin-bottom: 40px;
}

.settings-subtitle {
    color: var(--psx-text-muted);
    font-size: 14px;
    margin: 4px 0 0 0;
}

.history-container,
.settings-container {
    padding-bottom: 80px !important;
}

.settings-section {
    margin-bottom: 48px;
}

.settings-section-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--psx-text-muted);
    letter-spacing: 1px;
    margin-bottom: 24px;
    text-transform: uppercase;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 0;
    border-bottom: 1px solid #f2f4f7;
}

.settings-row:last-child {
    border-bottom: none;
}

.row-info {
    flex: 1;
}

.row-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--psx-text);
    margin-bottom: 4px;
}

.row-desc {
    font-size: 13px;
    color: var(--psx-text-muted);
}

.row-action {
    margin-left: 40px;
}

.static-val {
    font-size: 15px;
    font-weight: 500;
    color: var(--psx-text);
    overflow-wrap: anywhere;
}

.row-link {
    margin-top: 12px;
}

.delete-link {
    color: #d92d20;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.delete-link:hover {
    color: #b42318;
    text-decoration: underline;
}

.info-link {
    color: #3c6e96;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.info-link:hover {
    color: #325a7a;
    text-decoration: underline;
}

.plagscanx-library-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.plagscanx-library-table {
    min-width: 640px;
}

@media (max-width: 640px) {
    .settings-container {
        max-width: none;
        padding: 24px 16px 96px !important;
    }

    .settings-header-box {
        margin-bottom: 24px;
    }

    .settings-section {
        margin-bottom: 32px;
    }

    .settings-section-label {
        margin-bottom: 12px;
    }

    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 18px 0;
    }

    .row-info,
    .row-action {
        width: 100%;
        min-width: 0;
    }

    .row-action {
        margin-left: 0;
        display: flex;
        justify-content: flex-start;
    }

    .usage-detail-card .stats-row {
        flex-wrap: wrap;
    }

    .plagscanx-cta-tooltip-wrap[data-tooltip]::after {
        left: 0;
        right: auto;
        max-width: min(260px, calc(100vw - 32px));
    }

    .plagscanx-cta-tooltip-wrap[data-tooltip]::before {
        left: 18px;
        right: auto;
    }
}

/* ========================================
   MOBILE ELEMENTS (hidden on desktop)
   ======================================== */

@media (max-width: 900px) {
    .plagscanx-app-overlay {
        position: fixed;
        inset: 0;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    .plagscanx-app-container {
        flex-direction: column;
        height: 100%;
        max-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide desktop sidebar on mobile */
    .plagscanx-sidebar-left {
        display: none !important;
    }

    .plagscanx-sidebar-right {
        width: 100%;
        height: auto;
        border: none;
        overflow: visible;
    }

    .plagscanx-main {
        overflow: visible;
    }

    .plagscanx-input-card {
        min-height: 380px;
        height: auto;
    }

    .plagscanx-editor-container {
        padding: 20px 15px 0 15px;
    }

    #view-text .plagscanx-editor-container,
    #view-ai_detect .plagscanx-editor-container {
        padding-bottom: 20px;
    }

    #plagscanx-text,
    #plagscanx-ai-text,
    #psx-new-text {
        min-height: 380px;
        height: auto;
        padding: 15px 15px;
    }

    .ai-highlight-overlay {
        padding: 15px;
    }

    .plagscanx-sidebar-footer,
    .plagscanx-editor-toolbar {
        position: static;
    }


    /* ---- App Header — Responsive ---- */
    .plagscanx-app-header {
        flex-wrap: wrap;
        padding: 8px 16px;
        gap: 8px;
    }

    .header-left {
        flex: 1;
        min-width: 0;
    }

    .header-left h2 {
        font-size: 14px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-right {
        gap: 10px;
        flex-wrap: wrap;
    }

    .header-info-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        flex: 0 0 auto;
        padding: 6px;
        color: var(--psx-text-muted);
    }

    .header-right .desktop-label {
        display: none !important;
    }

    .header-right .mobile-label {
        display: inline !important;
        font-size: 13px;
        font-weight: 500;
        color: var(--psx-text);
    }

    /* Report actions — icon only on mobile */
    .header-action-btn .btn-text,
    .header-share-btn .btn-text {
        display: none;
    }

    .header-action-btn,
    .header-share-btn {
        padding: 6px 10px !important;
        min-width: 40px;
        justify-content: center;
    }

    /* ---- Plagiarism / AI Editor Toolbar — Mobile Layout ---- */
    .plagscanx-editor-toolbar {
        display: flex;
        flex-wrap: wrap;
        padding: 12px 16px 16px;
        gap: 8px;
        align-items: stretch;
    }

    .toolbar-left {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1 1 100%;
        width: 100%;
        flex-wrap: wrap;
    }

    .toolbar-left .counter-item {
        flex: 1 1 100%;
    }

    .toolbar-left .toolbar-item:not(.counter-item) {
        flex: 1 1 145px;
        min-width: 0;
    }

    .toolbar-left .plagscanx-btn-upload {
        width: 100%;
        justify-content: center;
    }

    .toolbar-right {
        display: flex;
        width: 100%;
        gap: 8px;
    }

    .toolbar-right .plagscanx-btn-secondary {
        margin-right: 0 !important;
        flex: 0 0 auto;
    }

    .toolbar-right .plagscanx-btn-primary {
        flex: 1 1 auto;
        min-width: 0;
    }

    .toolbar-right .plagscanx-cta-tooltip-wrap {
        flex: 1 1 auto;
        min-width: 0;
    }

    .plagscanx-btn-upload {
        padding: 6px 10px;
        font-size: 12px;
    }

    .plagscanx-btn-primary {
        padding: 10px 16px;
        font-size: 13px;
        justify-content: center;
    }

    /* ---- Rewriter / Humanizer / Grammar Toolbar — Mobile Layout ---- */
    /* Row 1: word count + selector  |  Row 2: Clear + CTA              */
    .rewriter-toolbar {
        flex-wrap: wrap;
        padding: 10px 12px;
        gap: 8px;
    }

    /* Row 1: word count + tone/intensity selector — full width */
    .rewriter-toolbar-left {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .rewriter-toolbar-left .rw-tone-select {
        flex: 1;
        min-width: 0;
    }

    /* Row 2: Clear + CTA — full width */
    .rewriter-toolbar-right {
        width: 100%;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .rewriter-toolbar-right .plagscanx-btn-primary {
        flex: 1;
    }

    .rewriter-toolbar-right .plagscanx-cta-tooltip-wrap {
        flex: 1;
        min-width: 0;
    }

    /* ---- Input Card textarea — height synced with card ---- */
    .plagscanx-input-card textarea {
        min-height: 380px;
    }

    /* ---- Secondary Buttons — Compact ---- */
    .plagscanx-btn-secondary {
        padding: 6px 10px;
        font-size: 12px;
    }

    .plagscanx-modal-overlay {
        padding: 12px;
    }

    .plagscanx-modal-content {
        width: calc(100vw - 24px);
        padding: 28px 18px;
        border-radius: 10px;
    }
}

/* Login Modal */
.plagscanx-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.plagscanx-modal-content {
    background: #fff;
    width: 90%;
    max-width: 440px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 40px 30px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.plagscanx-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--psx-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.plagscanx-modal-close:hover {
    color: var(--psx-text);
}

.psx-quota-modal {
    max-width: 540px;
    padding: 30px;
    text-align: left;
    border-radius: 14px;
}

.psx-pro-feature-modal {
    max-width: 440px;
    text-align: center;
}

.psx-quota-modal.psx-pro-feature-modal .quota-modal-message {
    max-width: 360px;
    margin-right: auto;
    margin-left: auto;
}

.psx-pro-feature-modal .pro-feature-modal-actions {
    width: 100%;
    justify-content: center;
}

.psx-pro-feature-modal #btn-pro-feature-pricing {
    min-width: 152px;
}

#plagscanx-unified-gate-modal {
    z-index: 100003;
}

#plagscanx-unified-gate-modal .psx-unified-gate-modal {
    display: grid;
    grid-template-columns: minmax(320px, 0.88fr) minmax(440px, 1.12fr);
    width: min(1040px, calc(100vw - 48px));
    max-width: 1040px;
    height: min(680px, calc(100dvh - 48px));
    max-height: 680px;
    padding: 0;
    overflow: hidden;
    border-radius: 16px;
    text-align: left;
}

.psx-unified-gate-media {
    position: relative;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: var(--psx-surface-soft);
}

.psx-unified-gate-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--psx-gate-image-position, center);
}

.psx-unified-gate-testimonial {
    position: absolute;
    right: 24px;
    bottom: 24px;
    left: 24px;
    margin: 0;
    padding: 22px;
    border: 0;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #fff;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.24);
}

.psx-unified-gate-testimonial p {
    margin: 0;
    font-size: 16px;
    line-height: 1.55;
}

.psx-unified-gate-testimonial footer {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.78);
}

.psx-unified-gate-testimonial strong {
    color: #fff;
    font-weight: 600;
}

.psx-unified-gate-content {
    position: relative;
    min-width: 0;
    overflow-y: auto;
    padding: 38px 40px 32px;
    scrollbar-color: var(--psx-border-strong) transparent;
    scrollbar-width: thin;
}

.psx-unified-gate-content .plagscanx-modal-close {
    top: 16px;
    right: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--psx-radius-control);
}

.psx-unified-gate-content .plagscanx-modal-close:hover {
    background: var(--psx-surface-soft);
}

.psx-unified-gate-header {
    padding-right: 32px;
}

.psx-unified-gate-header h2 {
    margin: 0 0 8px;
    color: var(--psx-text-strong);
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: 0;
}

.psx-unified-gate-header p {
    max-width: 54ch;
    margin: 0;
    color: var(--psx-text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.psx-unified-gate-cycle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0 18px;
}

.psx-unified-gate-cycle[hidden],
.psx-unified-gate-plan[hidden],
.psx-unified-plan-price[hidden] {
    display: none !important;
}

.psx-unified-cycle-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--psx-text-muted);
    font-size: 13px;
    font-weight: 500;
}

.psx-unified-cycle-label.is-active {
    color: var(--psx-text-strong);
}

.psx-unified-cycle-label small {
    padding: 3px 7px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--psx-primary) 10%, #fff);
    color: var(--psx-primary);
    font-size: 11px;
    font-weight: 600;
}

.psx-unified-gate-plans {
    display: grid;
    gap: 10px;
}

.psx-unified-gate-plan {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 18px;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 78px;
    padding: 14px 16px;
    border: 1px solid var(--psx-border);
    border-radius: 8px;
    background: var(--psx-surface);
    color: var(--psx-text-strong);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.psx-unified-gate-plan:hover {
    border-color: var(--psx-border-strong);
    background: var(--psx-surface-muted);
}

.psx-unified-gate-plan.is-selected {
    border-color: var(--psx-primary);
    background: color-mix(in srgb, var(--psx-primary) 5%, #fff);
    box-shadow: 0 0 0 1px var(--psx-primary);
}

.psx-unified-gate-plan:focus-visible {
    outline: 2px solid var(--psx-primary);
    outline-offset: 2px;
}

.psx-unified-plan-copy,
.psx-unified-plan-title-line,
.psx-unified-plan-price {
    min-width: 0;
}

.psx-unified-plan-copy {
    display: grid;
    gap: 4px;
}

.psx-unified-plan-title-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.psx-unified-plan-title-line > strong {
    font-size: 15px;
    font-weight: 600;
}

.psx-unified-plan-badge {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--psx-text-strong);
    color: var(--psx-surface);
    font-size: 10px;
    font-weight: 600;
}

.psx-unified-plan-description,
.psx-unified-plan-note {
    overflow: hidden;
    color: var(--psx-text-muted);
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.psx-unified-plan-price {
    display: grid;
    justify-items: end;
    gap: 3px;
    text-align: right;
}

.psx-unified-plan-price > span {
    display: flex;
    align-items: baseline;
    gap: 3px;
    white-space: nowrap;
}

.psx-unified-plan-price strong {
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}

.psx-unified-plan-price small {
    color: var(--psx-text-muted);
    font-size: 11px;
}

.psx-unified-plan-radio {
    position: relative;
    width: 16px;
    height: 16px;
    border: 1px solid var(--psx-border-strong);
    border-radius: 50%;
}

.psx-unified-gate-plan.is-selected .psx-unified-plan-radio {
    border: 5px solid var(--psx-primary);
}

.psx-unified-gate-benefits {
    margin-top: 22px;
}

.psx-unified-gate-benefits h3 {
    margin: 0 0 12px;
    color: var(--psx-text-strong);
    font-size: 15px;
    line-height: 1.3;
}

.psx-unified-gate-benefits ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.psx-unified-gate-benefits li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
    color: var(--psx-text-strong);
    font-size: 12px;
    line-height: 1.4;
}

.psx-unified-gate-benefits .psx-icon {
    flex: 0 0 15px;
    width: 15px;
    height: 15px;
    margin-top: 1px;
    color: var(--psx-success);
}

.psx-unified-gate-actions {
    margin-top: 26px;
}

.psx-unified-gate-actions .psx-unified-gate-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    text-decoration: none;
}

.psx-unified-gate-actions .psx-icon {
    width: 17px;
    height: 17px;
}

@media (max-width: 860px) {
    #plagscanx-unified-gate-modal .psx-unified-gate-modal {
        grid-template-columns: minmax(250px, 0.72fr) minmax(390px, 1.28fr);
        width: min(820px, calc(100vw - 32px));
    }

    .psx-unified-gate-content {
        padding-right: 28px;
        padding-left: 28px;
    }

    .psx-unified-gate-testimonial {
        right: 18px;
        bottom: 18px;
        left: 18px;
        padding: 18px;
    }

    .psx-unified-gate-testimonial p {
        font-size: 14px;
    }
}

@media (max-width: 700px) {
    #plagscanx-unified-gate-modal {
        align-items: flex-end;
        padding: 0;
    }

    #plagscanx-unified-gate-modal .psx-unified-gate-modal {
        display: block;
        width: 100%;
        max-width: none;
        height: auto;
        max-height: calc(100dvh - 12px);
        border-radius: 16px 16px 0 0;
    }

    .psx-unified-gate-media {
        display: none;
    }

    .psx-unified-gate-content {
        max-height: calc(100dvh - 12px);
        padding: 30px 18px calc(18px + env(safe-area-inset-bottom));
    }

    .psx-unified-gate-header h2 {
        font-size: 23px;
    }

    .psx-unified-gate-plan {
        grid-template-columns: minmax(0, 1fr) auto 18px;
        min-height: 72px;
        padding: 12px;
    }

    .psx-unified-gate-benefits ul {
        grid-template-columns: 1fr;
    }

    .psx-unified-gate-actions {
        position: sticky;
        bottom: calc(-18px - env(safe-area-inset-bottom));
        z-index: 2;
        margin-right: -18px;
        margin-left: -18px;
        padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--psx-border);
        background: var(--psx-surface);
    }
}

@media (max-width: 390px) {
    .psx-unified-gate-plan {
        grid-template-columns: minmax(0, 1fr) 16px;
        gap: 10px;
    }

    .psx-unified-plan-price {
        grid-column: 1;
        grid-row: 2;
        justify-items: start;
        text-align: left;
    }

    .psx-unified-plan-radio {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}

#plagscanx-confirm-modal {
    z-index: 100002;
}

.psx-confirm-modal {
    max-width: 440px;
    text-align: center;
}

.psx-quota-modal.psx-confirm-modal .quota-modal-message {
    max-width: 360px;
    margin-right: auto;
    margin-left: auto;
    white-space: pre-line;
}

.psx-confirm-modal .confirmation-modal-icon {
    background: #fff7ed;
    color: #c2410c;
}

.psx-confirm-modal .psx-confirm-actions {
    width: 100%;
    flex-direction: row;
    justify-content: center;
}

.psx-confirm-modal .psx-confirm-actions .plagscanx-btn-primary,
.psx-confirm-modal .psx-confirm-actions .plagscanx-btn-secondary {
    box-sizing: border-box;
    min-width: 124px;
    min-height: 38px;
}

.psx-quota-modal .quota-modal-icon {
    width: 54px;
    height: 54px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--psx-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.psx-quota-modal .quota-modal-icon .psx-icon {
    width: 26px;
    height: 26px;
}

.psx-quota-modal h2 {
    margin: 0 0 10px;
    color: var(--psx-text-strong);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

.psx-quota-modal .quota-modal-message {
    margin: 0;
    color: var(--psx-text-muted);
    font-size: 14px;
    line-height: 1.6;
    text-align: center;
}

.quota-usage-panel,
.quota-recommendation-panel {
    margin-top: 18px;
    border: 1px solid var(--psx-border);
    border-radius: 8px;
    padding: 14px;
    background: #f8fafc;
}

.quota-usage-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    color: var(--psx-text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.quota-usage-row strong {
    color: var(--psx-text-strong);
    font-size: 14px;
    font-weight: 700;
    text-transform: none;
    text-align: right;
}

.quota-progress-track {
    width: 100%;
    height: 8px;
    margin-top: 12px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.quota-progress-track span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--psx-primary);
    transition: width 0.25s ease;
}

.quota-remaining-text {
    margin-top: 9px;
    color: var(--psx-text-muted);
    font-size: 13px;
    line-height: 1.4;
}

.quota-reset-summary {
    margin: 10px 0 0;
    padding-top: 10px;
    border-top: 1px solid var(--psx-border);
    color: var(--psx-text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.quota-recommendation-panel {
    background: #111827;
    border-color: #111827;
    color: #fff;
}

.quota-recommendation-panel.is-addon {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #7c2d12;
}

.quota-recommendation-eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #dbeafe;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.quota-recommendation-panel.is-addon .quota-recommendation-eyebrow {
    background: #ffedd5;
    color: #9a3412;
}

.quota-recommendation-panel h3 {
    margin: 10px 0 6px;
    color: inherit;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.quota-recommendation-panel p {
    margin: 0;
    color: inherit;
    opacity: 0.86;
    font-size: 13px;
    line-height: 1.55;
}

.quota-recommendation-panel ul {
    display: grid;
    gap: 7px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.quota-recommendation-panel li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    color: inherit;
    font-size: 13px;
    line-height: 1.4;
}

.quota-recommendation-panel li .psx-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
    margin-top: 1px;
    color: #22c55e;
}

.quota-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.quota-modal-actions .plagscanx-btn-primary,
.quota-modal-actions .plagscanx-btn-secondary {
    min-width: 124px;
    border-radius: 6px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.quota-modal-actions .plagscanx-btn-primary .psx-icon {
    width: 16px;
    height: 16px;
}

#plagscanx-quota-modal .quota-modal-actions {
    width: 100%;
}

#plagscanx-quota-modal .quota-modal-actions .plagscanx-btn-primary {
    width: 100%;
    min-height: 44px;
}

.psx-share-modal {
    max-width: 520px;
    padding: 30px;
    text-align: left;
    border-radius: 8px;
}

.psx-share-modal .share-modal-icon {
    width: 48px;
    height: 48px;
    margin: 0 0 16px;
    border-radius: 50%;
    background: #eef2ff;
    color: var(--psx-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.psx-share-modal .share-modal-icon .psx-icon {
    width: 23px;
    height: 23px;
}

.psx-share-modal h2 {
    margin: 0 0 8px;
    color: var(--psx-text-strong);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.share-modal-message {
    margin: 0;
    color: var(--psx-text-muted);
    font-size: 14px;
    line-height: 1.55;
}

.share-warning {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 18px;
    padding: 12px;
    border: 1px solid #fde68a;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    font-size: 13px;
    line-height: 1.45;
}

.share-warning .psx-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 17px;
    margin-top: 1px;
}

.share-link-label {
    display: block;
    margin-top: 18px;
    margin-bottom: 8px;
    color: var(--psx-text-strong);
    font-size: 12px;
    font-weight: 700;
}

.share-link-field {
    width: 100%;
}

.share-link-field input {
    min-width: 0;
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--psx-border);
    border-radius: 6px;
    background: var(--psx-surface-muted);
    color: var(--psx-text);
    font-size: 13px;
}

.share-modal-actions .plagscanx-btn-primary,
.share-modal-actions .plagscanx-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px !important;
    white-space: nowrap;
}

.share-modal-actions .psx-icon {
    width: 16px;
    height: 16px;
}

.share-modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.share-link-toggle-row {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
    cursor: pointer;
    user-select: none;
}

.share-link-toggle-copy {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.share-link-toggle-title {
    color: var(--psx-text-strong);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.share-link-toggle-status {
    color: var(--psx-text-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.3;
}

.share-link-toggle-row .plagscanx-toggle-container {
    flex: 0 0 auto;
}

.share-link-toggle-row.is-loading {
    cursor: wait;
}

.share-link-toggle-row.is-loading .toggle-slider {
    cursor: wait;
    opacity: 0.65;
}

.share-link-toggle-row input:focus-visible + .toggle-slider {
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--psx-primary) 24%, transparent);
}

.share-link-field input:disabled {
    color: var(--psx-text-muted);
    cursor: not-allowed;
    opacity: 0.68;
}

.modal-icon-wrapper {
    width: 48px;
    height: 48px;
    background: #eef2ff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 20px;
}

.modal-icon-wrapper .dashicons {
    color: var(--psx-primary);
    font-size: 24px;
}

.modal-site-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.plagscanx-modal-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--psx-text);
    margin: 0 0 10px;
}

.plagscanx-modal-header p {
    font-size: 15px;
    color: var(--psx-text-muted);
    line-height: 1.5;
    margin: 0 0 30px;
}

.plagscanx-modal-body {
    margin-bottom: 25px;
}

/* Force Google Button Center */
.g_id_signin iframe {
    margin: 0 auto !important;
}

.g_id_signin>div {
    margin: 0 auto;
}

.plagscanx-modal-footer p {
    font-size: 11px;
    color: var(--psx-text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Premium Login Card (Inline) */
.plagscanx-login-page-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 60px 20px;
    background: #f9fbfd;
    border-radius: 16px;
    margin: 20px 0;
}

.plagscanx-login-card {
    background: #fff;
    width: 100%;
    max-width: 480px;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.plagscanx-login-card .plagscanx-modal-header {
    margin-bottom: 35px;
}

.plagscanx-login-card .modal-icon-wrapper {
    width: 80px;
    height: 80px;
    background: #f0f7ff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 24px;
}

.plagscanx-login-card .modal-icon-wrapper .dashicons {
    font-size: 36px;
    color: var(--psx-link);
}

.plagscanx-login-card h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--psx-text);
    margin: 0 0 12px 0;
}

.plagscanx-login-card p {
    font-size: 16px;
    color: var(--psx-text-muted);
    line-height: 1.6;
    margin: 0;
}

.plagscanx-login-card .plagscanx-modal-body {
    background: none;
    padding: 0;
    margin: 35px 0;
}

.plagscanx-login-card .g_id_signin {
    display: flex;
    justify-content: center;
}

.plagscanx-login-card .plagscanx-modal-footer {
    border-top: 1px solid #f0f0f1;
    padding-top: 25px;
    margin-top: 25px;
}

.plagscanx-login-card .plagscanx-modal-footer p {
    font-size: 13px;
    color: var(--psx-text-muted);
}

/* ============================
   AI Detector Results
   ============================ */

/* Highlight overlay - mirrors textarea appearance */
.ai-highlight-overlay {
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    padding: 30px;
    font-size: 16px;
    line-height: 1.6;
    color: var(--psx-text);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    cursor: text;
}

/* Individual highlight spans */
.ai-highlight {
    --psx-ai-highlight-accent: var(--psx-ring, #a1a1aa);
    padding: 2px 0;
    border-radius: 2px;
    transition: box-shadow 0.15s ease;
    cursor: default;
}

.ai-highlight:hover {
    box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--psx-ai-highlight-accent) 62%, transparent);
}

.ai-highlight.ai-hl-ai {
    background: rgba(231, 76, 60, 0.25);
    --psx-ai-highlight-accent: var(--psx-risk-high, #dc2626);
}

.ai-highlight.ai-hl-likely {
    background: rgba(230, 126, 34, 0.25);
    --psx-ai-highlight-accent: var(--psx-risk-medium, #ea580c);
}

.ai-highlight.ai-hl-mixed {
    background: rgba(241, 196, 15, 0.25);
    --psx-ai-highlight-accent: var(--psx-risk-low, #ca8a04);
}

.ai-highlight.ai-hl-human {
    --psx-ai-highlight-accent: var(--psx-risk-safe, #16a34a);
}

/* AI result gauge and sentence distribution */
.ai-result-overview {
    padding: 2px 0 22px;
    border-bottom: 1px solid var(--psx-border, #e4e4e7);
    text-align: center;
}

.ai-result-description {
    max-width: 34ch;
    margin: 12px auto 0;
    color: var(--psx-card-foreground, var(--psx-text, #18181b));
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

:is(#ai-results, .psx-ai-report) {
    --ai-result-color: #52525b;
    --ai-result-tint: #f4f4f5;
}

:is(#ai-results, .psx-ai-report).ai-result-human {
    --ai-result-color: #15803d;
    --ai-result-tint: #dcfce7;
}

:is(#ai-results, .psx-ai-report).ai-result-mixed {
    --ai-result-color: #a16207;
    --ai-result-tint: #fef3c7;
}

:is(#ai-results, .psx-ai-report).ai-result-likely {
    --ai-result-color: #c2410c;
    --ai-result-tint: #ffedd5;
}

:is(#ai-results, .psx-ai-report).ai-result-generated {
    --ai-result-color: #b91c1c;
    --ai-result-tint: #fee2e2;
}

.ai-writing-patterns {
    padding: 22px 0;
    border-bottom: 1px solid var(--psx-border, #e4e4e7);
}

.ai-writing-patterns[hidden] {
    display: none;
}

.ai-writing-patterns h4 {
    margin: 0 0 12px;
    color: var(--psx-card-foreground, var(--psx-text, #18181b));
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
}

.ai-pattern-list {
    display: block;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-pattern-list:not(:empty) + .psx-ai-artifacts {
    margin-top: 22px;
}

.ai-pattern-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 100%;
    margin: 0;
    padding: 14px 0;
    border: 0;
    border-bottom: 1px solid var(--psx-border, #e4e4e7);
    border-radius: 0;
    color: var(--psx-text, #18181b);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.psx-ai-pattern-copy { flex: 1; min-width: 0; }
.psx-ai-pattern-copy small { display: block; margin-top: 4px; color: var(--psx-text-muted, #71717a); font-size: 12px; }
.plagscanx-app-container .psx-ai-pattern-highlight {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px;
    width: 36px; height: 36px; padding: 8px; border: 1px solid var(--psx-border, #e4e4e7);
    border-radius: 50%; background: transparent; color: var(--psx-text, #18181b); cursor: pointer;
}
.psx-ai-pattern-highlight svg { width: 18px; height: 18px; }
.plagscanx-app-container .psx-ai-pattern-highlight:is(:hover, [aria-pressed="true"]) { background: var(--psx-muted, #f4f4f5); color: var(--psx-primary, #4f5ee8); }
.psx-ai-pattern-highlight:focus-visible, .ai-highlight[data-ai-detail]:focus-visible { outline: 2px solid var(--psx-primary, #4f5ee8); outline-offset: 2px; }
.ai-highlight.is-pattern-match { box-shadow: inset 0 -2px var(--psx-primary, #4f5ee8); outline: 1px solid var(--psx-primary, #4f5ee8); }
.ai-highlight[data-ai-detail] { cursor: pointer; }
.psx-ai-pattern-lock { position: relative; padding: 20px 0 0; text-align: center; }
.psx-ai-pattern-placeholder { display: grid; gap: 10px; padding: 6px 16px; filter: blur(4px); user-select: none; }
.psx-ai-pattern-placeholder span { display: block; height: 9px; background: var(--psx-border, #e4e4e7); border-radius: 4px; }
.psx-ai-pattern-placeholder span:nth-child(2) { width: 80%; }
.psx-ai-pattern-placeholder span:nth-child(3) { width: 60%; }
.psx-ai-pattern-lock p { margin: 16px 0 12px; font-size: 14px; color: var(--psx-text, #18181b); }
.psx-ai-passage-tooltip {
    position: fixed; z-index: 100010; width: max-content; max-width: min(360px, calc(100vw - 24px));
    max-height: min(360px, calc(100dvh - 24px)); overflow: auto; box-sizing: border-box;
    padding: 12px 14px; border-radius: 6px; background: #18181b; color: #fff;
    font-size: 13px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere;
    box-shadow: 0 4px 16px #0002;
}
.psx-ai-passage-tooltip[hidden] { display: none; }
@media (max-width: 900px) {
    .plagscanx-app-container .psx-ai-pattern-highlight { flex-basis: 40px; width: 40px; height: 40px; }
}
@media print {
    .psx-ai-pattern-highlight, .psx-ai-passage-tooltip { display: none !important; }
    .ai-pattern-list li { break-inside: avoid; }
}

.ai-sentence-breakdown {
    padding-top: 22px;
}

.ai-breakdown-header {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ai-breakdown-header h4,
.ai-breakdown-header p {
    margin: 0;
}

.ai-breakdown-header h4 {
    color: var(--psx-card-foreground, var(--psx-text, #18181b));
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
}

.ai-breakdown-header p {
    margin-top: 2px;
    color: var(--psx-muted-foreground, var(--psx-text-muted, #71717a));
    font-size: 12px;
    line-height: 16px;
}

.ai-breakdown-header p strong {
    color: inherit;
    font-weight: 500;
}

.ai-breakdown-info {
    position: relative;
    flex: 0 0 auto;
}

.ai-breakdown-info summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: var(--psx-radius-xl, 8px);
    background: transparent;
    color: var(--psx-muted-foreground, var(--psx-text-muted, #71717a));
    cursor: pointer;
    list-style: none;
}

.ai-breakdown-info summary::-webkit-details-marker {
    display: none;
}

.ai-breakdown-info summary:hover,
.ai-breakdown-info summary:focus-visible,
.ai-breakdown-info[open] summary {
    background: var(--psx-muted, #f4f4f5);
    color: var(--psx-card-foreground, var(--psx-text, #18181b));
}

.ai-breakdown-info summary:focus-visible {
    outline: 2px solid var(--psx-ring, #a1a1aa);
    outline-offset: 2px;
}

.ai-breakdown-info summary .psx-icon {
    width: 16px;
    height: 16px;
}

.ai-threshold-popover {
    position: absolute;
    z-index: 20;
    top: 34px;
    right: 0;
    width: 232px;
    padding: 12px;
    border: 1px solid var(--psx-border, #e4e4e7);
    border-radius: var(--psx-radius-xl, 10px);
    background: var(--psx-popover, #ffffff);
    box-shadow: var(--psx-shadow-popover, 0 10px 24px rgb(0 0 0 / 0.12));
    color: var(--psx-popover-foreground, var(--psx-text, #18181b));
    text-align: left;
}

.ai-threshold-popover > strong {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
}

.ai-threshold-popover ul {
    display: grid;
    gap: 7px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ai-threshold-popover li {
    display: grid;
    grid-template-columns: 8px minmax(0, 1fr) auto;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    line-height: 16px;
}

.ai-threshold-popover li small {
    color: var(--psx-muted-foreground, var(--psx-text-muted, #71717a));
    font-size: 10px;
}

.ai-breakdown-list {
    display: grid;
    gap: 17px;
    margin-top: 20px;
}

.ai-breakdown-row-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.ai-breakdown-label {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    color: var(--psx-card-foreground, var(--psx-text, #18181b));
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
}

.ai-breakdown-dot {
    width: 8px;
    height: 8px;
    flex: 0 0 8px;
    border-radius: 50%;
    background: var(--ai-breakdown-color, var(--psx-border-strong, #d4d4d8));
}

.ai-breakdown-values {
    min-width: 3ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ai-breakdown-values strong {
    color: var(--psx-card-foreground, var(--psx-text, #18181b));
    font-size: 13px;
    font-weight: 600;
}

.ai-breakdown-track {
    width: 100%;
    height: 6px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: var(--psx-radius-full, 9999px);
    background: var(--psx-border, #e4e4e7);
}

.ai-breakdown-track > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--ai-breakdown-color);
    transition: width 300ms ease;
}

.ai-breakdown-track > span.has-value {
    min-width: 3px;
}

.ai-breakdown-row.is-generated,
.ai-breakdown-dot.is-generated {
    --ai-breakdown-color: var(--psx-risk-high, #dc2626);
}

.ai-breakdown-row.is-likely,
.ai-breakdown-dot.is-likely {
    --ai-breakdown-color: var(--psx-risk-medium, #ea580c);
}

.ai-breakdown-row.is-mixed,
.ai-breakdown-dot.is-mixed {
    --ai-breakdown-color: var(--psx-risk-low, #ca8a04);
}

.ai-breakdown-row.is-human,
.ai-breakdown-dot.is-human {
    --ai-breakdown-color: var(--psx-risk-safe, #16a34a);
}

@media (prefers-reduced-motion: reduce) {
    .ai-breakdown-track > span {
        transition: none;
    }
}

/* ========= Text Rewriter ========= */

.rewriter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    min-height: calc(100vh - 120px);
}

.rewriter-panel {
    flex: 1;
    min-width: 300px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rewriter-panel-header {
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.rewriter-panel-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--psx-text);
    line-height: 28px;
}

.rewriter-textarea {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    font-family: inherit;
    color: var(--psx-text);
    min-height: 300px;
    box-sizing: border-box;
    background: #fff;
}

.rewriter-textarea::placeholder {
    color: #bbb;
}

.rewriter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    background: #fff;
    gap: 12px;
}

.rewriter-toolbar-left {
    font-size: 13px;
    color: var(--psx-text-muted);
    font-weight: 500;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.header-usage-text {
    display: inline-flex;
    align-items: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--psx-muted-foreground, var(--psx-text-muted));
    font-size: 13px;
    line-height: 1.4;
}

.header-usage-full {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.header-usage-label {
    font-weight: 400;
}

.header-usage-value,
.header-usage-compact {
    font-weight: 500;
}

.header-usage-compact {
    display: none;
}

@media (max-width: 900px) {
    .header-usage-text {
        font-size: 11px;
    }

    .header-usage-full {
        display: none;
    }

    .header-usage-compact {
        display: inline;
    }
}

.rw-char-info {
    font-size: 12px;
    color: var(--psx-text-muted);
}

.rw-word-count {
    font-weight: 600;
    color: var(--psx-text-muted);
}

.rewriter-toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rw-tone-select {
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    font-size: 13px;
    color: var(--psx-text);
    background-color: #fff;
    cursor: pointer;
    outline: none;
    height: 36px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: none;
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

.rw-tone-select:focus {
    border-color: #667eea;
}

/* Output States */
.rw-state-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--psx-text-muted);
    min-height: 300px;
}

.rw-state-box p {
    margin: 8px 0 0;
    font-size: 15px;
    color: var(--psx-text-muted);
}

.rw-state-box p.sub {
    font-size: 13px;
    color: var(--psx-text-muted);
}

.rw-output-text {
    flex: 1;
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--psx-text);
    min-height: 300px;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: #fff;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
    font-family: inherit;
}

/* Spinner */
.rw-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8e8e8;
    border-top: 3px solid var(--psx-primary);
    border-radius: 50%;
    animation: rwSpin 0.8s linear infinite;
}

@keyframes rwSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Copy Button */
.rw-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    font-size: 12px;
    font-weight: 500;
    color: var(--psx-text);
    cursor: pointer;
    transition: all 0.15s;

}

.rw-copy-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.rw-copy-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Daily Usage Badge */
.rw-daily-usage {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    color: var(--psx-text-muted);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 900px) {
    .rewriter-grid {
        flex-direction: column;
        min-height: auto;
    }

    .rewriter-panel {
        width: 100%;
        min-width: 0;
    }
}

/* ========= LP Tool Widget ========= */
.plagscanx-lp-widget {
    width: 100%;
    min-width: 0;
    font-family: inherit;
    margin: 0 auto;
    color: var(--psx-text-strong);
}

.plagscanx-lp-widget *,
.plagscanx-lp-widget *::before,
.plagscanx-lp-widget *::after {
    box-sizing: border-box;
}

.plagscanx-lp-widget .lp-widget-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--psx-border);
    border-radius: var(--psx-radius-card);
    background: var(--psx-surface);
    box-shadow: var(--psx-shadow-soft);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.plagscanx-lp-widget .lp-widget-card:focus-within {
    border-color: var(--psx-border-strong);
}

.plagscanx-lp-widget .lp-textarea-wrap {
    min-width: 0;
    padding: 24px;
}

.plagscanx-lp-widget textarea {
    display: block;
    width: 100%;
    min-height: 360px;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--psx-text);
    background: transparent;
    box-shadow: none;
}

.plagscanx-lp-widget textarea::placeholder {
    color: var(--psx-text-muted);
    opacity: 0.8;
}

.plagscanx-lp-widget .lp-widget-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 16px;
    min-height: 64px;
    padding: 12px 16px;
    border-top: 1px solid var(--psx-border);
    background: var(--psx-surface-muted);
}

.plagscanx-lp-widget .lp-toolbar-left,
.plagscanx-lp-widget .lp-toolbar-right {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
}

.plagscanx-lp-widget .lp-toolbar-right {
    justify-content: flex-end;
}

.plagscanx-lp-widget .lp-word-indicator {
    display: inline-flex;
    align-items: baseline;
    min-width: 0;
    gap: 4px;
    font-size: 13px;
    font-weight: 400;
    line-height: 20px;
    color: var(--psx-text-muted);
    white-space: nowrap;
}

.plagscanx-lp-widget .lp-word-count {
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    color: var(--psx-text);
}

.plagscanx-lp-widget .lp-toolbar-divider {
    flex: 0 0 1px;
    width: 1px;
    height: 20px;
    margin: 0 2px;
    background: var(--psx-border);
}

.plagscanx-lp-upload-btn {
    max-width: min(240px, 48vw);
}

.plagscanx-lp-widget .lp-upload-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plagscanx-lp-cta {
    min-width: 176px;
}

.plagscanx-lp-widget .plagscanx-lp-upload-btn .psx-icon,
.plagscanx-lp-widget .plagscanx-lp-btn-secondary .psx-icon,
.plagscanx-lp-widget .plagscanx-lp-cta .psx-icon {
    width: 16px;
    height: 16px;
    margin: 0;
    flex: 0 0 16px;
}

/* LP Widget Responsive */
@media (max-width: 760px) {
    .plagscanx-lp-widget .lp-widget-toolbar {
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 10px;
    }

    .plagscanx-lp-widget .lp-toolbar-left,
    .plagscanx-lp-widget .lp-toolbar-right {
        width: 100%;
    }

    .plagscanx-lp-widget .lp-toolbar-right {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .plagscanx-lp-widget .plagscanx-lp-cta {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .plagscanx-lp-widget .lp-textarea-wrap {
        padding: 16px;
    }

    .plagscanx-lp-widget textarea {
        min-height: 300px;
        font-size: 16px;
    }

    .plagscanx-lp-widget .lp-widget-toolbar {
        min-height: 0;
        padding: 12px;
    }

    .plagscanx-lp-widget .lp-toolbar-left {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .plagscanx-lp-widget .lp-toolbar-divider {
        display: none;
    }

    .plagscanx-lp-widget .plagscanx-lp-upload-btn {
        max-width: 48vw;
    }

    .plagscanx-lp-widget .lp-toolbar-right {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .plagscanx-lp-widget .plagscanx-lp-clear {
        width: 40px;
        min-width: 40px;
        height: 40px;
        min-height: 40px;
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .plagscanx-lp-widget .lp-clear-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }
}

.plagscanx-btn-primary {
    background: var(--psx-primary) !important;
    color: #fff;
    border: none;
    padding: 0 24px;
    border-radius: 25px !important;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    line-height: 1;
}

.plagscanx-btn-primary:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.plagscanx-btn-primary:disabled {
    border-color: var(--psx-disabled-border) !important;
    background: var(--psx-disabled-bg) !important;
    color: var(--psx-disabled-foreground) !important;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
    opacity: 1;
}

:is(.plagscanx-cta-tooltip-wrap, .psx-tooltip-wrap) {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.plagscanx-cta-tooltip-wrap .plagscanx-btn-primary {
    width: 100%;
}

:is(.plagscanx-cta-tooltip-wrap, .psx-tooltip-wrap)[data-tooltip]:hover::before,
:is(.plagscanx-cta-tooltip-wrap, .psx-tooltip-wrap)[data-tooltip]:hover::after,
:is(.plagscanx-cta-tooltip-wrap, .psx-tooltip-wrap)[data-tooltip]:focus-within::before,
:is(.plagscanx-cta-tooltip-wrap, .psx-tooltip-wrap)[data-tooltip]:focus-within::after,
:is(.plagscanx-cta-tooltip-wrap, .psx-tooltip-wrap)[data-tooltip].tooltip-open::before,
:is(.plagscanx-cta-tooltip-wrap, .psx-tooltip-wrap)[data-tooltip].tooltip-open::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

:is(.plagscanx-cta-tooltip-wrap, .psx-tooltip-wrap)[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    z-index: 100000;
    width: max-content;
    max-width: 260px;
    padding: 8px 10px;
    border-radius: 6px;
    background: #111827;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

:is(.plagscanx-cta-tooltip-wrap, .psx-tooltip-wrap)[data-tooltip]::before {
    content: "";
    position: absolute;
    right: 18px;
    bottom: calc(100% + 4px);
    z-index: 100001;
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #111827 transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    pointer-events: none;
}

.psx-deep-search.psx-tooltip-wrap[data-tooltip]::after {
    top: calc(100% + 10px);
    right: 0;
    bottom: auto;
}

.psx-deep-search.psx-tooltip-wrap[data-tooltip]::before {
    top: calc(100% + 4px);
    right: 18px;
    bottom: auto;
    border-width: 0 6px 6px;
    border-color: transparent transparent #111827;
}

.plagscanx-btn-secondary {
    background: #fff;
    color: var(--psx-text);
    border: 1px solid #d0d5dd;
    padding: 0 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    line-height: 1;
}

.plagscanx-btn-secondary:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #b0b8c6;
}

.plagscanx-lp-btn-secondary {
    background: transparent;
    border: 1px solid #ddd;
    color: var(--psx-text-muted);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 10px;
}

.plagscanx-lp-btn-secondary:hover {
    background: #f5f5f5;
    border-color: #ccc;
    color: var(--psx-text);
}

.rw-copy-btn {
    background: transparent;
    border: 1px solid #d0d5dd;
    color: var(--psx-text);
    padding: 0px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.rw-copy-btn:hover {
    background: #f9fafb;
    border-color: #b0b8c6;
}

.rw-spinner {
    margin: 0 auto 15px auto;
}

/* Consumption card sections */
.consumption-section {
    margin-bottom: 12px;
}

.plagscanx-progress-fill.ai {
    background: var(--psx-success);
    /* Green bar from mockup */
}

.tier-display {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    text-align: center;
}

.tier-display .badge {
    background: #f0f2ff;
    color: var(--psx-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Usage Details Grid */
.usage-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.usage-detail-card {
    background: #fff;
    border: 1px solid #f0f0f1;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.usage-detail-card:hover {
    border-color: #d0d5dd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.usage-detail-card .tool-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.usage-detail-card .tool-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--psx-text);
}

.usage-detail-card .reset-date {
    font-size: 11px;
    color: var(--psx-text-muted);
    letter-spacing: 0.2px;
}

.usage-detail-card .usage-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.usage-detail-card .stats-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 14px;
    font-weight: 400;
}

.usage-detail-card .used-val {
    font-weight: 400;
    font-size: 14px;
    color: var(--psx-text);
}

.usage-detail-card .limit-val {
    font-size: 14px;
    color: var(--psx-text-muted);
}

.usage-bar-mini {
    height: 6px;
    background: #f0f0f1;
    border-radius: 3px;
    overflow: hidden;
}

.usage-bar-mini .fill {
    height: 100%;
    transition: width 0.3s ease;
}

.usage-bar-mini .fill.usage-low {
    background: var(--psx-success);
}

.usage-bar-mini .fill.usage-medium {
    background: var(--psx-warning);
}

.usage-bar-mini .fill.usage-high {
    background: var(--psx-danger);
}

/* Simple Usage Details (Verification View) */
.simple-usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

}

.simple-usage-header .simple-usage-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--psx-text);
    margin: 0;
}

.simple-usage-wrapper {
    display: flex;
    flex-direction: column;
    margin: 5px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 15px;
    line-height: 20px;
}

.simple-usage-details-card {
    background: #fff;
    border: 1px solid #dfe1e5;
    border-radius: 8px;
    padding: 15px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.simple-usage-details-card .tool-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--psx-text);
    font-size: 14px;
}

.simple-pro-usage-details-card {
    background: #fff;
    padding: 5px 0px;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
}

.simple-pro-usage-details-card .tool-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--psx-text);
    font-size: 12px;

}

.simple-pro-usage-details-card .usage-stats {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.simple-pro-usage-details-card .stats-row {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 14px;
    font-weight: 400;
}

.simple-pro-usage-details-card .used-val {
    font-weight: 400;
    font-size: 12px;
    color: var(--psx-text);
}

.simple-pro-usage-details-card .limit-val {
    font-size: 12px;
    color: var(--psx-text-muted);
}


@media (max-width: 768px) {
    .usage-details-grid {
        grid-template-columns: 1fr;
    }
}

/* Header Profile Menu */
.plagscanx-header-profile {
    position: relative !important;
    display: inline-block !important;
    overflow: visible !important;
    z-index: 999999 !important;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.plagscanx-profile-trigger {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 999999 !important;
    position: relative !important;
    -webkit-tap-highlight-color: transparent;
}

.profile-avatar-img-small {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    transition: transform 0.2s;
    pointer-events: none !important;
    /* clicks pass through to the button parent */
}

.plagscanx-profile-trigger:hover .profile-avatar-img-small {
    transform: scale(1.05);
}

.plagscanx-profile-dropdown {
    position: absolute !important;
    top: calc(100% + 10px) !important;
    right: 5px !important;
    width: 320px !important;
    background: #fff !important;
    border-radius: 12px !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25) !important;
    z-index: 2147483647 !important;
    overflow: visible !important;
    display: none;
    border: 1px solid #f0f0f1 !important;
    padding-bottom: 8px;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Bridge the gap for hover stability */
.plagscanx-profile-dropdown::before {
    content: "";
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
    background: transparent;
}

@keyframes plagscanx-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f1;
}

.profile-user-info {
    flex: 1;
}

.profile-name {
    font-weight: 700;
    color: var(--psx-text);
    font-size: 15px;
}

.profile-email {
    font-size: 12px;
    color: var(--psx-text-muted);
    margin-top: 2px;
}

/* Sidebar-Style Usage Widget in Dropdown */
.profile-usage-section.sidebar-style {
    padding: 16px 20px;
    background: #fcfcfd;
    border-bottom: 1px solid #f0f0f1;
}

.consumption-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.consumption-card-header .usage-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--psx-text);
    margin: 0;
}

.consumption-card-header .badge {
    background: #eef2ff;
    color: var(--psx-primary);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.consumption-section .consumption-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--psx-text-muted);
}

.consumption-section .value {
    font-weight: 600;
    color: var(--psx-text);
}

.usage-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.usage-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--psx-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.usage-title .dashicons {
    font-size: 18px;
    color: var(--psx-primary);
}

.tier-badge {
    font-size: 11px;
    font-weight: 600;
    color: var(--psx-text-muted);
    text-transform: uppercase;
    background: #f0f0f1;
    padding: 2px 8px;
    border-radius: 4px;
}

.usage-numbers {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.numbers-val {
    font-weight: 500;
    color: var(--psx-text);
}

.percent-val {
    color: var(--psx-text-muted);
}

.usage-bar-outer {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.usage-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.usage-bar-fill.usage-low {
    background: var(--psx-success);
}

.usage-bar-fill.usage-medium {
    background: var(--psx-warning);
}

.usage-bar-fill.usage-high {
    background: var(--psx-danger);
}

/* Sidebar-Style Upgrade Button */
.plagscanx-upgrade-box-small {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 4px 12px;
    border-radius: 50px;
    color: var(--psx-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.plagscanx-upgrade-box-small:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.upgrade-icon {
    font-size: 14px;
}

.profile-menu-list {
    list-style: none;
    padding: 10px 0;
    margin: 0;
}

.profile-menu-list li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--psx-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.1s;
}

.profile-menu-list li a:hover {
    background: #f8fafc;
    color: var(--psx-text);
}

.profile-menu-list li a .dashicons {
    font-size: 18px;
    color: var(--psx-text-muted);
}

.profile-menu-list .menu-divider {
    height: 1px;
    background: #f0f0f1;
    margin: 5px 0;
}

.profile-menu-list .logout-link {
    color: var(--psx-danger);
}

.profile-menu-list .logout-link .dashicons {
    color: var(--psx-danger);
}

/* Guest sign in button */
.plagscanx-btn-signin {
    background: var(--psx-cta) !important;
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 25px !important;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.plagscanx-btn-signin:hover {
    background: var(--psx-cta-hover);
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========================================
   PRICING PAGE VIEW
   ======================================== */

.plagscanx-pricing-wrapper {
    padding: 40px 30px;
    max-width: 1100px;
    margin: 0 10px;
}

#view-pricing {
    overflow-y: auto;
    height: 100%;
}

/* Pricing Header */
.plagscanx-pricing-header {
    text-align: center;
    margin-bottom: 40px;
}

.plagscanx-pricing-header h1 {
    font-size: 32px;
    font-weight: 800;
    color: var(--psx-text);
    margin: 0 0 8px 0;
    letter-spacing: 0;
}

.plagscanx-pricing-header h4 {
    font-size: 16px;
    font-weight: 400;
    color: var(--psx-text-muted);
    margin: 0;
}

/* Pricing Grid */
.plagscanx-pricing-grid {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Pricing Card */
.plagscanx-pricing-card {
    min-width: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: box-shadow 0.25s, transform 0.25s;
}

.plagscanx-pricing-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Highlighted Card */
.plagscanx-pricing-card.highlighted {
    border: 2px solid var(--psx-primary);
    box-shadow: 0 4px 20px rgba(77, 97, 252, 0.12);
}

.plagscanx-pricing-card.highlighted:hover {
    box-shadow: 0 8px 30px rgba(77, 97, 252, 0.18);
}

/* Most Popular Badge */
.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--psx-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: var(--psx-radius-control);
    text-transform: uppercase;
    letter-spacing: 0;
    white-space: nowrap;
}

/* Card Header */
.pricing-card-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
}

.pricing-card-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--psx-text);
    margin: 0 0 6px 0;
}

.pricing-card-desc {
    font-size: 13px;
    color: var(--psx-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Price Display */
.pricing-price {
    margin-top: 14px;
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.price-amount {
    font-size: 36px;
    font-weight: 800;
    color: var(--psx-text);
    letter-spacing: 0;
    line-height: 1;
}

.price-period {
    font-size: 15px;
    font-weight: 400;
    color: var(--psx-text-muted);
}

/* Features List */
.pricing-features {
    list-style: none;
    padding: 0;
    margin: 0 0 auto 0;
    flex: 1;
}

.pricing-features li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13.5px;
    color: var(--psx-text);
    padding: 6px 0;
    line-height: 1.4;
}

.pricing-features li .dashicons {
    color: var(--psx-success);
    font-size: 16px;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Card Footer */
.pricing-card-footer {
    margin-top: 24px;
    text-align: center;
}

/* CTA Button */
.pricing-cta-btn {
    display: inline-block;
    width: 100%;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 25px !important;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--psx-cta);
    color: #fff;
    border: none;
    box-sizing: border-box;
}

.pricing-cta-btn:hover {
    background: var(--psx-cta-hover);
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    color: #fff;
}

/* Highlighted card CTA */
.plagscanx-pricing-card.highlighted .pricing-cta-btn {
    background: var(--psx-cta);
}

.plagscanx-pricing-card.highlighted .pricing-cta-btn:hover {
    background: var(--psx-cta-hover);
    transform: translateY(-1px);
    color: #fff;
}

/* Disabled CTA (Current Plan) */
.pricing-cta-btn.disabled {
    background: #f3f4f6 !important;
    color: var(--psx-text-muted) !important;
    cursor: default;
    pointer-events: none;
    box-shadow: none;
}

.pricing-cta-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ========================================
   EXTRA WORDS ADD-ON BANNER
   ======================================== */

.plagscanx-addon-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: color-mix(in srgb, var(--psx-primary) 7%, #fff);
    border: 1px solid color-mix(in srgb, var(--psx-primary) 18%, #fff);
    border-radius: var(--psx-radius-card);
    padding: 24px 28px;
    margin-top: 10px;
    gap: 20px;
}

.addon-banner-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.addon-banner-icon {
    font-size: 32px;
    line-height: 1;
    flex-shrink: 0;
}

.addon-banner-text h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--psx-text);
    margin: 0 0 4px 0;
}

.addon-banner-text p {
    font-size: 13.5px;
    color: var(--psx-text-muted);
    margin: 0;
    line-height: 1.4;
}

.addon-cta-btn {
    display: inline-block;
    padding: 11px 28px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 25px !important;
    text-decoration: none;
    white-space: nowrap;
    background: var(--psx-cta) !important;
    color: #fff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.addon-cta-btn:hover {
    background: var(--psx-cta-hover);
    transform: translateY(-1.5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    color: #fff;
}

/* ========================================
   PRICING PAGE RESPONSIVE
   ======================================== */

@media (max-width: 900px) {
    .plagscanx-pricing-wrapper {
        padding: 24px 16px;
    }

    .plagscanx-pricing-header h1 {
        font-size: 24px;
    }

    .plagscanx-pricing-grid {
        grid-template-columns: 1fr;
    }

    .plagscanx-addon-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .addon-banner-content {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .plagscanx-pricing-grid {
        grid-template-columns: 1fr;
    }

    .plagscanx-pricing-header h1 {
        font-size: 22px;
    }

    .plagscanx-pricing-header {
        margin-bottom: 24px;
    }
}

/* Billing Toggle (Monthly / Yearly) Styles */
.pricing-billing-toggle {
    display: inline-flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 30px;
    margin: 0 auto 30px auto;
    position: relative;
    border: 1px solid #e2e8f0;
}

.billing-toggle-btn {
    border: none;
    background: transparent;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--psx-text-muted);
    border-radius: var(--psx-radius-control);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    outline: none;
}

.billing-toggle-btn.active {
    background: #fff;
    color: var(--psx-text);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.billing-toggle-btn .discount-badge {
    background: var(--psx-success);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.plagscanx-pricing-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Lucide Icons integration styling overrides */
.psx-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    stroke-width: 2px;
    vertical-align: middle;
    line-height: 1;
    color: inherit;
}
.psx-icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
}
/* Match specific placements */
.plagscanx-nav li .psx-icon {
    margin-right: 12px;
    color: #27272a;
}
.plagscanx-nav li.active .psx-icon {
    color: var(--psx-link);
}
.plagscanx-toast .psx-icon {
    margin-right: 10px;
    width: 24px;
    height: 24px;
}
.profile-menu-list li a .psx-icon {
    margin: 0;
    color: var(--psx-text-muted);
}
.header-action-btn .psx-icon,
.header-share-btn .psx-icon {
    color: var(--psx-text-muted);
}
.plagscanx-logout-link .psx-icon {
    margin-right: 8px;
}
.plagscanx-upgrade-btn .psx-icon {
    margin-right: 6px;
}
.step-item.done .step-icon .psx-icon {
    color: #fff;
    width: 16px;
    height: 16px;
}
.rw-copy-btn .psx-icon, .gc-copy-btn .psx-icon, .hz-copy-btn .psx-icon {
    margin-right: 6px;
}
.plagscanx-lp-upload-btn .psx-icon {
    margin-right: 8px;
}
.pricing-features li .psx-icon {
    color: var(--psx-success);
    margin-right: 8px;
    width: 16px;
    height: 16px;
}
.plagscanx-user-card .psx-icon {
    color: var(--psx-text-muted);
    margin-left: auto;
}
.psx-icon.spin {
    animation: psx-spin 1.2s linear infinite;
}
@keyframes psx-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.psx-crown-icon {
    color: #eab308;
    fill: rgba(234, 179, 8, 0.2);
    vertical-align: middle;
}

/* Info Sliding Drawer Overlay */
.plagscanx-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999999;
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: flex-end;
}

/* Sliding Drawer content container */
.plagscanx-drawer {
    width: 100%;
    max-width: 450px;
    height: 100%;
    background: #fff;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    position: relative;
    right: -450px; /* Initially hidden off-screen */
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.plagscanx-drawer.open {
    right: 0 !important;
}

/* Header styling */
.plagscanx-drawer .drawer-header {
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.plagscanx-drawer .drawer-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--psx-text-strong);
}

.plagscanx-drawer .drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--psx-text-muted);
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background 0.15s ease;
    border-radius: 50%;
}
.plagscanx-drawer .drawer-close:hover {
    color: var(--psx-text);
    background: var(--psx-surface-soft);
}

/* Body styling */
.plagscanx-drawer .drawer-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.6;
    color: var(--psx-text);
}

/* Style headings inside drawer body */
.plagscanx-drawer .drawer-body h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--psx-text-strong);
    margin: 20px 0 8px 0;
}
.plagscanx-drawer .drawer-body h3:first-child {
    margin-top: 0;
}

.plagscanx-drawer .drawer-body p {
    margin: 0 0 16px 0;
    color: var(--psx-text-muted);
}

.plagscanx-drawer .drawer-body ul {
    margin: 10px 0 16px 20px;
    padding: 0;
    list-style-type: none;
}

.plagscanx-drawer .drawer-body ul li {
    position: relative;
    margin-bottom: 8px;
    color: var(--psx-text-muted);
    padding-left: 15px;
}

.plagscanx-drawer .drawer-body ul li::before {
    content: "•";
    color: var(--psx-warning);
    font-size: 18px;
    position: absolute;
    left: 0;
    top: -2px;
}

/* Footer styling */
.plagscanx-drawer .drawer-footer {
    padding: 24px;
    border-top: 1px solid #f1f5f9;
    background: #fff;
}

/* Mobile responsive drawer */
@media (max-width: 640px) {
    .plagscanx-drawer {
        max-width: 100%;
        right: -100%;
    }
}

/* Custom Select Buttons */
.plagscanx-select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 8px 14px !important;
    min-width: 178px;
    height: 37px;
    box-sizing: border-box;
    font-size: 13px;
    font-weight: 500;
    color: var(--psx-text);
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.plagscanx-select-btn:hover {
    border-color: #bbb;
    background: #fff;
}

.plagscanx-select-btn:focus {
    border-color: #bbb;
    box-shadow: 0 0 0 2px rgba(77, 97, 252, 0.08);
}

.plagscanx-select-btn .select-leading-icon,
.plagscanx-select-btn .select-chevron {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: var(--psx-text-muted);
}

.plagscanx-select-btn .selected-val {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plagscanx-select-btn .select-chevron {
    margin-left: auto;
}

/* Settings Selector Card Grids */
.settings-card-grid {
    display: grid;
    gap: 16px;
    margin: 16px 0;
}

.settings-card-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.settings-card-grid.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.settings-card {
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 4px;
    user-select: none;
}

.settings-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.settings-card.active {
    border-color: var(--psx-primary) !important;
    background-color: #eff6ff !important;
}

.settings-card h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--psx-text-strong);
}

.settings-card p {
    margin: 0;
    font-size: 12px;
    color: var(--psx-text-muted);
    line-height: 1.4;
}

/* Unified app controls */
.plagscanx-btn-primary,
.plagscanx-lp-cta,
.pricing-cta-btn,
.addon-cta-btn,
.plagscanx-btn-signin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 20px;
    border: 1px solid transparent;
    border-radius: var(--psx-radius-control) !important;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.2s, filter 0.2s;
}

.plagscanx-btn-primary {
    background: var(--psx-primary) !important;
    color: #fff;
}

.plagscanx-lp-cta,
.pricing-cta-btn,
.addon-cta-btn,
.plagscanx-btn-signin {
    background: var(--psx-cta) !important;
    color: #fff;
}

.plagscanx-btn-primary:hover:not(:disabled) {
    filter: brightness(1.08);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--psx-shadow-hover);
}

.plagscanx-lp-cta:hover:not(:disabled),
.pricing-cta-btn:hover,
.addon-cta-btn:hover,
.plagscanx-btn-signin:hover {
    background: var(--psx-cta-hover) !important;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: var(--psx-shadow-hover);
}

.plagscanx-btn-primary:disabled,
.plagscanx-lp-cta:disabled,
.pricing-cta-btn.disabled {
    background: var(--psx-disabled-bg) !important;
    color: var(--psx-disabled-foreground) !important;
    border-color: var(--psx-disabled-border) !important;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
    opacity: 1;
}

.plagscanx-btn-secondary,
.plagscanx-btn-upload,
.plagscanx-lp-upload-btn,
.plagscanx-lp-btn-secondary,
.rw-copy-btn,
.plagscanx-select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 14px !important;
    border: 1px solid var(--psx-border-strong);
    border-radius: var(--psx-radius-control);
    background: var(--psx-surface);
    color: var(--psx-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.plagscanx-btn-secondary:hover:not(:disabled),
.plagscanx-btn-upload:hover,
.plagscanx-lp-upload-btn:hover,
.plagscanx-lp-btn-secondary:hover,
.rw-copy-btn:hover,
.plagscanx-select-btn:hover {
    background: var(--psx-surface-muted);
    border-color: var(--psx-border-strong);
    color: var(--psx-text);
}

.plagscanx-btn-secondary:disabled,
.plagscanx-btn-upload:disabled,
.plagscanx-lp-upload-btn:disabled,
.plagscanx-lp-btn-secondary:disabled,
.rw-copy-btn:disabled,
.plagscanx-select-btn:disabled {
    background: var(--psx-surface-soft);
    color: var(--psx-text-muted);
    cursor: not-allowed;
    opacity: 0.8;
}

.plagscanx-btn-primary:focus-visible,
.plagscanx-btn-secondary:focus-visible,
.plagscanx-btn-upload:focus-visible,
.plagscanx-lp-cta:focus-visible,
.plagscanx-lp-upload-btn:focus-visible,
.plagscanx-lp-btn-secondary:focus-visible,
.pricing-cta-btn:focus-visible,
.addon-cta-btn:focus-visible,
.plagscanx-btn-signin:focus-visible,
.rw-copy-btn:focus-visible,
.plagscanx-select-btn:focus-visible {
    outline: 2px solid var(--psx-primary);
    outline: 2px solid color-mix(in srgb, var(--psx-primary) 36%, transparent);
    outline-offset: 2px;
}

.rw-copy-btn {
    min-height: 30px;
    padding: 0 10px !important;
    font-size: 12px;
}

.plagscanx-select-btn {
    min-width: 178px;
    justify-content: flex-start;
}

.plagscanx-select-btn:focus {
    border-color: var(--psx-border-strong);
    box-shadow: 0 0 0 2px rgba(77, 97, 252, 0.12);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--psx-primary) 12%, transparent);
}

/* Unified modal content */
.psx-modal-compact {
    max-width: 450px;
    text-align: left;
    padding: 30px;
}

.psx-modal-wide {
    max-width: 550px;
    text-align: left;
    padding: 30px;
}

.psx-modal-header-centered {
    text-align: center;
    margin-bottom: 20px;
}

.psx-modal-header {
    margin-bottom: 20px;
}

.psx-modal-title {
    margin: 0 0 5px;
    font-size: 18px;
    font-weight: 700;
    color: var(--psx-text-strong);
    line-height: 1.25;
}

.psx-modal-wide .psx-modal-title {
    font-size: 20px;
    margin-bottom: 0;
}

.psx-modal-subtitle,
.psx-modal-helper,
.settings-card p {
    color: var(--psx-text-muted);
}

.psx-modal-subtitle {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

.psx-modal-helper {
    display: block;
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.4;
}

.psx-modal-body > .psx-modal-helper:first-child {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 500;
}

.psx-modal-body {
    padding: 10px 0;
}

.psx-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

.psx-modal-footer-bordered {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--psx-border);
}

.psx-setting-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.psx-setting-label {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--psx-text-strong);
    font-size: 13px;
    font-weight: 600;
}

.psx-setting-input-wrapper {
    position: relative;
}

.psx-setting-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--psx-border-strong);
    border-radius: var(--psx-radius-control);
    background: var(--psx-surface);
    color: var(--psx-text);
    font-size: 13px;
}

.psx-setting-input[readonly] {
    background: var(--psx-surface-soft);
    color: var(--psx-text-muted);
    cursor: pointer;
}

.psx-setting-helper {
    margin: 0;
    color: var(--psx-text-muted);
    font-size: 11px;
}

.psx-setting-check-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    margin-bottom: 20px;
    border-top: 1px solid var(--psx-border);
    border-bottom: 1px solid var(--psx-border);
}

.psx-setting-check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    color: var(--psx-text-strong);
    font-size: 13px;
    font-weight: 600;
}

.psx-setting-check-label.is-locked {
    cursor: not-allowed;
}

.psx-setting-check-label:not(.is-locked) {
    cursor: pointer;
}

.psx-setting-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
}

.modal-icon-wrapper {
    background: #eef2ff;
    background: color-mix(in srgb, var(--psx-info) 10%, #fff);
    color: var(--psx-info);
}

.modal-icon-wrapper .psx-icon {
    width: 24px;
    height: 24px;
}

/* Library view */
.library-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
}

.library-quota-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.quota-stat-card,
.library-upload-card,
.library-list-card {
    background: var(--psx-surface);
    border: 1px solid var(--psx-border);
    border-radius: var(--psx-radius-card);
    box-shadow: var(--psx-shadow-soft);
}

.quota-stat-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
}

.library-stat-header,
.library-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.library-stat-label,
.library-list-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--psx-text);
    font-size: 13px;
    font-weight: 600;
}

.library-stat-label .psx-icon,
.library-list-title .psx-icon {
    width: 16px;
    height: 16px;
    color: var(--psx-text-muted);
}

.library-stat-number {
    margin: 4px 0;
    color: var(--psx-text-strong);
    font-size: 20px;
    font-weight: 700;
}

.library-stat-unit {
    color: var(--psx-text-muted);
    font-size: 12px;
    font-weight: 500;
}

.library-progress-track {
    width: 100%;
    height: 6px;
    margin-top: 4px;
    overflow: hidden;
    background: var(--psx-surface-soft);
    border-radius: 999px;
}

.library-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    transition: width 0.3s ease;
}

.library-progress-fill.is-storage {
    background: var(--psx-info);
}

.library-progress-fill.is-upload {
    background: var(--psx-success);
}

.library-tip-box {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 12px 16px;
    border: 1px solid #bfdbfe;
    border: 1px solid color-mix(in srgb, var(--psx-info) 24%, #fff);
    border-radius: var(--psx-radius-card);
    background: #eff6ff;
    background: color-mix(in srgb, var(--psx-info) 8%, #fff);
    color: var(--psx-info);
    font-size: 12px;
}

.library-tip-box .psx-icon {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.library-upload-card,
.library-list-card {
    padding: 24px;
    margin-bottom: 24px;
}

.library-upload-card {
    text-align: center;
}

.library-card-title {
    margin: 0 0 8px;
    color: var(--psx-text-strong);
    font-size: 16px;
    font-weight: 600;
}

.library-card-copy {
    margin: 0 0 20px;
    color: var(--psx-text-muted);
    font-size: 13px;
    line-height: 1.5;
}

.library-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 30px 20px;
    border: 2px dashed var(--psx-border-strong);
    border-radius: var(--psx-radius-card);
    background: var(--psx-surface-muted);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.library-dropzone:hover {
    border-color: var(--psx-primary);
    background: #f8fafc;
    background: color-mix(in srgb, var(--psx-primary) 6%, #fff);
}

.library-dropzone .psx-icon {
    width: 40px;
    height: 40px;
    color: var(--psx-text-muted);
}

.library-dropzone-main {
    color: var(--psx-text);
    font-size: 14px;
    font-weight: 500;
}

.library-dropzone-note,
.library-items-count {
    color: var(--psx-text-muted);
    font-size: 12px;
}

.library-list-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--psx-border);
}

.library-list-title {
    margin: 0;
    font-size: 16px;
}

.library-items-count {
    font-weight: 500;
}

.plagscanx-library-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 13px;
}

.plagscanx-library-table thead {
    border-bottom: 2px solid var(--psx-border);
    color: var(--psx-text-muted);
    font-weight: 600;
}

.plagscanx-library-table th {
    padding: 10px;
    font-weight: 600;
}

.plagscanx-library-table td {
    padding: 12px 10px;
}

.plagscanx-library-table tbody tr {
    border-bottom: 1px solid var(--psx-border);
    color: var(--psx-text);
    transition: background 0.15s;
}

.plagscanx-library-table tbody tr:hover {
    background: var(--psx-surface-muted);
}

.plagscanx-library-table .library-title-cell {
    font-weight: 500;
    word-break: break-word;
}

.plagscanx-library-table .library-meta-cell {
    color: var(--psx-text-muted);
}

.plagscanx-library-table .library-actions-cell {
    width: 80px;
    text-align: right;
}

.plagscanx-library-table .library-word-count-cell {
    width: 120px;
}

.plagscanx-library-table .library-date-cell {
    width: 180px;
}

.btn-delete-lib-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border: none;
    background: none;
    color: var(--psx-danger);
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    border-radius: var(--psx-radius-control);
}

.btn-delete-lib-item:hover {
    background: #fff5f5;
    background: color-mix(in srgb, var(--psx-danger) 9%, #fff);
}

.btn-delete-lib-item .psx-icon {
    width: 16px;
    height: 16px;
}

/* Pricing alignment */
.plagscanx-pricing-header h1,
.price-amount {
    letter-spacing: 0;
}

.plagscanx-pricing-card,
.plagscanx-addon-banner,
.usage-detail-card,
.plagscanx-profile-dropdown,
.plagscanx-consumption-card,
.plagscanx-lp-widget .lp-widget-card {
    border-radius: var(--psx-radius-card);
}

.plagscanx-pricing-card {
    border-color: var(--psx-border);
    box-shadow: var(--psx-shadow-soft);
}

.plagscanx-pricing-card:hover {
    box-shadow: var(--psx-shadow-hover);
}

.pricing-badge {
    background: var(--psx-primary);
    border-radius: var(--psx-radius-control);
    letter-spacing: 0;
}

.pricing-features li .psx-icon,
.pricing-features li .dashicons {
    color: var(--psx-success) !important;
}

.plagscanx-addon-banner {
    background: #f0f4ff;
    background: color-mix(in srgb, var(--psx-primary) 7%, #fff);
    border-color: #e0e7ff;
    border-color: color-mix(in srgb, var(--psx-primary) 18%, #fff);
}

.addon-banner-icon,
.upgrade-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--psx-primary);
}

.addon-banner-icon .psx-icon {
    width: 28px;
    height: 28px;
}

.upgrade-icon .psx-icon {
    width: 18px;
    height: 18px;
}

/* Tokenized drawer and selector polish */
.plagscanx-drawer .drawer-header,
.plagscanx-drawer .drawer-footer {
    border-color: var(--psx-border);
}

.plagscanx-drawer .drawer-header h3,
.plagscanx-drawer .drawer-body h3,
.settings-card h4 {
    color: var(--psx-text-strong);
}

.plagscanx-drawer .drawer-body,
.plagscanx-drawer .drawer-body p,
.plagscanx-drawer .drawer-body ul li,
.plagscanx-drawer .drawer-close {
    color: var(--psx-text-muted);
}

.plagscanx-drawer .drawer-body ul li::before {
    color: var(--psx-warning);
}

.settings-card {
    border-color: var(--psx-border);
    border-radius: var(--psx-radius-card);
}

.settings-card:hover {
    border-color: var(--psx-border-strong);
    box-shadow: var(--psx-shadow-soft);
}

.settings-card.active {
    border-color: var(--psx-primary) !important;
    background-color: #eff6ff !important;
    background-color: color-mix(in srgb, var(--psx-primary) 8%, #fff) !important;
}

/* Mobile responsive selector grids */
@media (max-width: 640px) {
    .settings-card-grid.grid-2,
    .settings-card-grid.grid-3 {
        grid-template-columns: 1fr;
    }

    .quota-modal-actions {
        flex-direction: column-reverse;
    }

    .quota-modal-actions .plagscanx-btn-primary,
    .quota-modal-actions .plagscanx-btn-secondary {
        width: 100%;
    }

    #plagscanx-quota-modal,
    #plagscanx-pro-feature-modal,
    #plagscanx-confirm-modal {
        align-items: flex-end;
        padding: 0;
    }

    #plagscanx-quota-modal .psx-quota-modal,
    #plagscanx-pro-feature-modal .psx-pro-feature-modal,
    #plagscanx-confirm-modal .psx-confirm-modal {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - 14px);
        padding: 26px 18px calc(18px + env(safe-area-inset-bottom));
        border-radius: 16px 16px 0 0;
    }

    .psx-confirm-modal .psx-confirm-actions {
        flex-direction: row;
    }

    .psx-confirm-modal .psx-confirm-actions .plagscanx-btn-primary,
    .psx-confirm-modal .psx-confirm-actions .plagscanx-btn-secondary {
        width: auto;
        flex: 1 1 0;
    }

    #plagscanx-share-modal {
        align-items: flex-end;
        padding: 0;
    }

    #plagscanx-share-modal .psx-share-modal {
        width: 100%;
        max-width: none;
        max-height: calc(100dvh - 14px);
        padding: 26px 18px calc(18px + env(safe-area-inset-bottom));
        border-radius: 16px 16px 0 0;
    }

    .share-modal-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .share-modal-actions .plagscanx-btn-primary,
    .share-modal-actions .plagscanx-btn-secondary {
        width: 100%;
    }

    .share-link-toggle-row {
        width: 100%;
        margin-right: 0;
        justify-content: space-between;
    }

    .quota-usage-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .quota-usage-row strong {
        text-align: left;
    }

    .psx-modal-footer,
    .psx-modal-footer-bordered {
        flex-direction: column-reverse;
    }

    .psx-modal-footer .plagscanx-btn-primary,
    .psx-modal-footer .plagscanx-btn-secondary,
    .psx-modal-footer-bordered .plagscanx-btn-primary,
    .psx-modal-footer-bordered .plagscanx-btn-secondary,
    .library-upload-card,
    .library-list-card {
        width: 100%;
    }

    .library-container {
        padding: 16px;
    }

    .library-upload-card,
    .library-list-card,
    .quota-stat-card {
        padding: 16px;
    }
}
#plagscanx-css-trigger-profile { position: fixed; z-index: 99990; }
.psx-login-verification { display: grid; gap: 12px; width: 100%; text-align: start; }
.psx-login-verification input { box-sizing: border-box; width: 100%; min-height: 44px; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--psx-border, #d4d4d8); border-radius: 6px; background: #fff; color: var(--psx-text, #18181b); }
.psx-login-verification label { font-size: 14px; font-weight: 500; }
.psx-login-body .plagscanx-btn-primary { width: 100%; min-height: 44px; }
/* Restricted accounts retain only support, billing management, and erasure actions. */
.psx-account-restricted { box-sizing: border-box; width: min(100%, 760px); margin: 64px auto; padding: 24px; color: var(--psx-text, #18181b); font-family: var(--psx-font-family, sans-serif); overflow-wrap: anywhere; }
.psx-account-restricted h1 { font-size: 28px; line-height: 1.25; margin: 0 0 16px; letter-spacing: 0; }
.psx-account-restricted h2 { font-size: 20px; line-height: 1.4; margin: 0 0 12px; letter-spacing: 0; }
.psx-account-restricted p { font-size: 16px; line-height: 1.6; margin: 0 0 20px; }
.psx-account-restricted .psx-restricted-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-block: 24px; }
.psx-account-restricted .psx-restricted-actions > *, .psx-account-restricted button { min-height: 44px; white-space: normal; text-align: center; }
.psx-account-restricted .psx-restricted-delete { border-top: 1px solid var(--psx-border, #e4e4e7); margin-top: 32px; padding-top: 28px; }
.psx-account-restricted dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto; box-sizing: border-box; border: 1px solid var(--psx-border, #e4e4e7); border-radius: 8px; background: white; color: inherit; padding: 24px; }
.psx-account-restricted dialog::backdrop { background: rgb(24 24 27 / .45); }
.psx-account-restricted :focus-visible { outline: 2px solid var(--psx-primary, #4f5dea); outline-offset: 3px; }
@media (max-width: 600px) { .psx-account-restricted { margin-block: 24px; padding: 20px; } .psx-account-restricted h1 { font-size: 24px; } }
.usage-detail-card[data-unlimited="true"] .usage-bar-mini,
.simple-usage-details-card[data-unlimited="true"] .usage-bar-mini,
.simple-pro-usage-details-card[data-unlimited="true"] .usage-bar-mini {
    display: none;
}
