/**
 * Public-facing styles for TPSub plugin
 */

:root {
    --tpsub-primary: #1d4ed8;
    --tpsub-primary-dark: #1e3a8a;
    --tpsub-secondary: #4338ca; /* Darkened from #6366f1 for better contrast with white text */
    --tpsub-success: #10b981;
    --tpsub-warning: #f59e0b;
    --tpsub-error: #ef4444;
    --tpsub-surface: #ffffff;
    --tpsub-background: #f5f7fb;
    --tpsub-border: #e2e8f0;
    --tpsub-text: #0f172a;
    --tpsub-muted: #64748b;
    --tpsub-radius-lg: 20px;
    --tpsub-radius: 14px;
    --tpsub-radius-sm: 10px;
    --tpsub-shadow: 0 30px 70px -50px rgba(15, 23, 42, 0.65);
    --tpsub-shadow-sm: 0 16px 40px -24px rgba(15, 23, 42, 0.35);
    --tpsub-shadow-xs: 0 8px 20px -12px rgba(15, 23, 42, 0.25);
    --tpsub-transition: 180ms ease;
    --tpsub-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Ensure no body/html margins that could cause header shift */
body.tpsub-browse-active,
body.tpsub-dashboard-active {
    margin: 0 !important;
    padding: 0 !important;
}

html {
    margin: 0 !important;
}

.tpsub-dashboard-page {
    position: relative;
}

/* Hide Astra header immediately when dashboard/browse page wrapper exists */
.tpsub-dashboard-page header#masthead,
.tpsub-browse-page header#masthead {
    display: none !important;
}

body.tpsub-dashboard-active header#masthead,
body.tpsub-dashboard-active .main-header-bar,
body.tpsub-dashboard-active .ast-mobile-header-wrap {
    display: none !important;
}

html.admin-bar,
body.admin-bar {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Prevent horizontal scroll on mobile */
body.tpsub-browse-active,
body.tpsub-dashboard-active {
    overflow-x: hidden;
}

body.tpsub-dashboard-active {
    padding-top: 0 !important;
}

body.tpsub-dashboard-active .entry-header,
body.tpsub-dashboard-active .entry-title,
body.tpsub-dashboard-active .page-title {
    display: none !important;
}

/* Browse Page Wrapper */
.tpsub-browse-page {
    min-height: 100vh;
    background: #ffffff;
    position: relative;
    overflow-x: hidden;
}

/* Hide Astra theme header when our custom page wrappers exist */
.tpsub-browse-page ~ header#masthead,
.tpsub-dashboard-page ~ header#masthead,
body:has(.tpsub-browse-page) header#masthead,
body:has(.tpsub-dashboard-page) header#masthead {
    display: none !important;
}

/* Alternative: Hide Astra header when browse/dashboard page is active */
body.tpsub-browse-active header#masthead,
body.tpsub-browse-active .main-header-bar,
body.tpsub-browse-active .ast-mobile-header-wrap,
body.tpsub-dashboard-active header#masthead,
body.tpsub-dashboard-active .main-header-bar,
body.tpsub-dashboard-active .ast-mobile-header-wrap {
    display: none !important;
}

body.tpsub-browse-active,
body.tpsub-dashboard-active {
    padding-top: 0 !important;
}

body.tpsub-browse-active .entry-header,
body.tpsub-browse-active .entry-title,
body.tpsub-browse-active .page-title,
body.tpsub-dashboard-active .entry-header,
body.tpsub-dashboard-active .entry-title,
body.tpsub-dashboard-active .page-title {
    display: none !important;
}

/* User Menu Styling (when repositioned) */
.tpsub-browse-user-menu,
.tpsub-dashboard-user-menu {
    background: #f8f9fa !important;
    padding: 12px 0 !important;
    border-bottom: 1px solid #dee2e6 !important;
    position: sticky;
    top: 90px;
    z-index: 99;
    margin: 0 !important;
}

.tpsub-browse-user-menu .ast-container,
.tpsub-dashboard-user-menu .ast-container {
    display: flex !important;
    justify-content: center !important;
    gap: 20px !important;
    flex-wrap: wrap !important;
    max-width: 1200px;
    margin: 0 auto !important;
    padding: 0 20px !important;
}

.tpsub-menu-link {
    color: #0073aa !important;
    text-decoration: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    transition: all 0.3s ease !important;
    font-weight: 500 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    background: transparent !important;
}

.tpsub-menu-link:hover {
    background: #e7f3f8 !important;
    transform: translateY(-1px);
}

.tpsub-menu-link[href*="logout"] {
    color: #dc3545 !important;
}

.tpsub-menu-link[href*="logout"]:hover {
    background: #f8d7da !important;
}

/* Content Spacing */
.tpsub-browse-page .tpsub-tender-list-wrapper {
    padding-top: 40px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tpsub-browse-user-menu,
    .tpsub-dashboard-user-menu {
        top: 70px;
        padding: 10px 0 !important;
    }

    .tpsub-browse-user-menu .ast-container,
    .tpsub-dashboard-user-menu .ast-container {
        gap: 10px !important;
    }

    .tpsub-menu-link {
        padding: 6px 12px !important;
        font-size: 14px !important;
    }

    /* Mobile responsive tabs */
    .tpsub-workspace-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 8px 12px;
    }

    .tpsub-workspace-tabs::-webkit-scrollbar {
        display: none;
    }

    .tpsub-tab-btn {
        font-size: 13px;
        padding: 8px 16px;
        white-space: nowrap;
    }

    .tpsub-tab-btn svg {
        width: 16px;
        height: 16px;
    }
}

body.tpsub-browse-active .site-content,
body.tpsub-browse-active .entry-content,
body.tpsub-dashboard-active .site-content,
body.tpsub-dashboard-active .entry-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

body.tpsub-browse-active #page,
body.tpsub-browse-active .site,
body.tpsub-browse-active .site-content,
body.tpsub-browse-active main,
body.tpsub-browse-active article,
body.tpsub-browse-active .tpsub-browse-page,
body.tpsub-dashboard-active #page,
body.tpsub-dashboard-active .site,
body.tpsub-dashboard-active .site-content,
body.tpsub-dashboard-active main,
body.tpsub-dashboard-active article,
body.tpsub-dashboard-active .tpsub-dashboard-page {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

body.tpsub-browse-active .site-content > .ast-container,
body.tpsub-dashboard-active .site-content > .ast-container {
    padding-top: 0 !important;
}

body.tpsub-browse-active .site-content > .ast-container > .ast-row,
body.tpsub-dashboard-active .site-content > .ast-container > .ast-row {
    margin-top: 0 !important;
}

body.tpsub-browse-active .ast-plain-container.ast-no-sidebar #primary,
body.tpsub-dashboard-active .ast-plain-container.ast-no-sidebar #primary {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

@media (min-width: 1200px) {
    body.tpsub-browse-active .ast-plain-container.ast-no-sidebar #primary,
    body.tpsub-dashboard-active .ast-plain-container.ast-no-sidebar #primary {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
}

.tpsub-browse-page .tp-container,
.tpsub-dashboard-page .tp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

.tpsub-browse-page .tp-header,
.tpsub-dashboard-page .tp-header {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 100vw;
    left: 0;
    right: 0;
    margin-left: 0;
    margin-right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--tp-gray-200);
    z-index: 1000;
    transition: all var(--tp-transition-base);
}

.tpsub-browse-page .tp-header.scrolled,
.tpsub-dashboard-page .tp-header.scrolled {
    box-shadow: var(--tp-shadow-md);
}

.tpsub-browse-page .tp-header-content,
.tpsub-dashboard-page .tp-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--tp-spacing-lg) 0;
}

.tpsub-browse-page .tp-header-logo a,
.tpsub-dashboard-page .tp-header-logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* Browse/Dashboard Page Header Overrides - Match Landing Page Exactly */
/* Only apply on desktop - let mobile use hamburger menu */
@media (min-width: 1024px) {
    .tpsub-browse-page .tp-header-nav,
    .tpsub-dashboard-page .tp-header-nav {
        display: flex !important;
        align-items: center !important;
        gap: var(--tp-spacing-6) !important;
    }
}

/* Fix nav links - remove Astra theme overrides */
.tpsub-browse-page .tp-header-nav .tp-nav-link,
.tpsub-browse-page .tp-header-nav a.tp-nav-link,
.tpsub-dashboard-page .tp-header-nav .tp-nav-link,
.tpsub-dashboard-page .tp-header-nav a.tp-nav-link {
    font-size: var(--tp-font-size-base) !important;
    color: var(--tp-gray-700) !important;
    font-weight: var(--tp-font-weight-medium) !important;
    transition: color var(--tp-transition-fast) !important;
    text-decoration: none !important;
    padding: var(--tp-spacing-sm) var(--tp-spacing-md) !important;
    border-bottom: none !important;
    background: transparent !important;
}

.tpsub-browse-page .tp-header-nav .tp-nav-link:hover,
.tpsub-browse-page .tp-header-nav .tp-nav-link:focus,
.tpsub-browse-page .tp-header-nav a.tp-nav-link:hover,
.tpsub-browse-page .tp-header-nav a.tp-nav-link:focus,
.tpsub-dashboard-page .tp-header-nav .tp-nav-link:hover,
.tpsub-dashboard-page .tp-header-nav .tp-nav-link:focus,
.tpsub-dashboard-page .tp-header-nav a.tp-nav-link:hover,
.tpsub-dashboard-page .tp-header-nav a.tp-nav-link:focus {
    color: var(--tp-primary) !important;
    text-decoration: none !important;
    border-bottom: none !important;
}

/* Fix button styling - override Astra theme */
.tpsub-browse-page .tp-header-nav .tp-btn,
.tpsub-browse-page .tp-header-nav a.tp-btn,
.tpsub-dashboard-page .tp-header-nav .tp-btn,
.tpsub-dashboard-page .tp-header-nav a.tp-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    padding: 10px 22px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    text-decoration: none !important;
    transition: transform var(--tp-transition-fast), box-shadow var(--tp-transition-fast) !important;
    border: none !important;
    cursor: pointer !important;
    background: transparent !important;
}

.tpsub-browse-page .tp-header-nav .tp-btn-primary,
.tpsub-browse-page .tp-header-nav a.tp-btn-primary,
.tpsub-dashboard-page .tp-header-nav .tp-btn-primary,
.tpsub-dashboard-page .tp-header-nav a.tp-btn-primary {
    background: var(--tp-accent) !important;
    color: #fff !important;
    box-shadow: 0 18px 40px -25px rgba(255, 107, 53, 0.85) !important;
}

.tpsub-browse-page .tp-header-nav .tp-btn-primary:hover,
.tpsub-browse-page .tp-header-nav a.tp-btn-primary:hover,
.tpsub-dashboard-page .tp-header-nav .tp-btn-primary:hover,
.tpsub-dashboard-page .tp-header-nav a.tp-btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 20px 50px -26px rgba(229, 90, 43, 0.9) !important;
    color: #fff !important;
}

.tpsub-browse-page .tp-header-nav .tp-btn-sm,
.tpsub-browse-page .tp-header-nav a.tp-btn-sm,
.tpsub-dashboard-page .tp-header-nav .tp-btn-sm,
.tpsub-dashboard-page .tp-header-nav a.tp-btn-sm {
    padding: 0.5rem 1.25rem !important;
    font-size: var(--tp-font-size-base) !important;
}

/* Mobile menu toggle should show on mobile, hide on desktop */
@media (min-width: 1024px) {
    .tpsub-browse-page .tp-mobile-menu-toggle,
    .tpsub-dashboard-page .tp-mobile-menu-toggle {
        display: none !important;
    }
}

.tpsub-dashboard-page .tpsub-dashboard {
    margin-top: 16px;
}

.tpsub-dashboard-page .tpsub-dashboard-user-menu {
    background: #f8fafc;
    border-bottom: 1px solid rgba(226, 232, 240, 0.65);
    width: 100%;
}

.tpsub-dashboard-page .tpsub-dashboard-user-menu .ast-container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
}

.tpsub-dashboard-page .tpsub-dashboard-user-menu .tpsub-menu-link {
    font-weight: 600;
    color: var(--tpsub-primary);
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    background: rgba(29, 78, 216, 0.08);
    transition: background var(--tpsub-transition), color var(--tpsub-transition);
}

.tpsub-dashboard-page .tpsub-dashboard-user-menu .tpsub-menu-link:hover {
    background: rgba(37, 99, 235, 0.15);
    color: var(--tpsub-primary-dark);
}

.tpsub-dashboard-page .tpsub-dashboard-user-menu .tpsub-menu-link:last-child {
    color: #dc2626;
    background: rgba(239, 68, 68, 0.1);
}

.tpsub-dashboard-page .tpsub-dashboard-user-menu .tpsub-menu-link:last-child:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #b91c1c;
}

/* Mobile responsive styles */
@media (max-width: 767px) {
    .tpsub-dashboard-page .tpsub-dashboard-user-menu .ast-container {
        justify-content: flex-start;
        gap: 12px;
    }

    .tpsub-dashboard-page .tpsub-dashboard-user-menu .tpsub-menu-link {
        width: calc(50% - 6px);
        text-align: center;
    }

    .tpsub-dashboard-page .tpsub-dashboard-user-menu .tpsub-menu-link:last-child {
        width: 100%;
    }
}

.tpsub-dashboard {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 24px 64px;
    font-family: var(--tpsub-font);
    color: var(--tpsub-text);
}

.tpsub-dashboard * {
    box-sizing: border-box;
}

.tpsub-notice {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 24px;
    border-radius: var(--tpsub-radius);
    border: 1px solid transparent;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(59, 130, 246, 0.12));
    color: var(--tpsub-text);
    box-shadow: var(--tpsub-shadow-xs);
    margin-bottom: 32px;
}

.tpsub-notice-success {
    border-color: rgba(16, 185, 129, 0.35);
}

.tpsub-notice-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(16, 185, 129, 0.14);
    position: relative;
}

.tpsub-notice-icon::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(59, 130, 246, 0.85));
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="none" viewBox="0 0 20 20"><path fill="%23fff" d="M7.975 10.85 5.6 8.475l-1.175 1.175L7.975 13.2l7.6-7.6L14.4 4.425z"/></svg>') center/contain no-repeat;
}

.tpsub-notice-body strong {
    font-weight: 600;
    display: block;
    margin-bottom: 2px;
}

.tpsub-notice-body span {
    color: var(--tpsub-muted);
    font-size: 0.95rem;
}

.tpsub-welcome-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 36px 40px;
    border-radius: var(--tpsub-radius-lg);
    background: linear-gradient(135deg, #1d4ed8, #2563eb, #4f46e5);
    color: #ffffff;
    box-shadow: var(--tpsub-shadow);
    overflow: hidden;
}

.tpsub-welcome-card::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: calc(var(--tpsub-radius-lg) - 10px);
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.18), rgba(79, 70, 229, 0.1));
    pointer-events: none;
}

.tpsub-welcome-content {
    position: relative;
    z-index: 1;
    max-width: 70%;
}

.tpsub-welcome-title {
    margin: 0 0 10px;
    font-size: 2rem;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.tpsub-welcome-subtitle {
    margin: 0;
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.85);
}

.tpsub-plan-status {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.tpsub-plan-copy {
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.tpsub-pro-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.45);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.tpsub-pro-icon {
    width: 16px;
    height: 16px;
    position: relative;
}

.tpsub-pro-icon::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none"><path fill="%23fff" d="m10 1.667 2.058 4.17 4.609.671-3.333 3.249.787 4.58L10 12.917l-4.121 2.42.787-4.58L3.333 6.508l4.61-.671L10 1.666Z"/></svg>') center/contain no-repeat;
}

/* Buttons */
.tpsub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--tpsub-transition), box-shadow var(--tpsub-transition), background var(--tpsub-transition), border var(--tpsub-transition);
}

.tpsub-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tpsub-btn:hover,
.tpsub-btn:focus,
.tpsub-btn:active {
    text-decoration: none !important;
}

.tpsub-btn:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.5);
    outline-offset: 2px;
}

.tpsub-btn-primary,
a.tpsub-btn-primary,
a.tpsub-btn-primary:link,
a.tpsub-btn-primary:visited {
    background: linear-gradient(135deg, #1e3a8a, #312e81); /* Darker gradient for better contrast */
    color: #ffffff !important;
    box-shadow: var(--tpsub-shadow-sm);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); /* Subtle shadow for better text visibility */
}

.tpsub-btn-primary:hover,
.tpsub-btn-primary:focus,
.tpsub-btn-primary:active,
a.tpsub-btn-primary:hover,
a.tpsub-btn-primary:focus,
a.tpsub-btn-primary:active {
    background: linear-gradient(135deg, #1e40af, #3730a3); /* Darker gradient on hover for better visibility */
    transform: translateY(-2px);
    box-shadow: 0 22px 40px -24px rgba(29, 78, 216, 0.75);
    color: #ffffff !important;
    text-decoration: none;
}

.tpsub-btn-outline {
    border-color: rgba(67, 56, 202, 0.25); /* Updated to match new secondary color */
    background: rgba(67, 56, 202, 0.05);
    color: var(--tpsub-primary-dark);
}

.tpsub-btn-outline:hover {
    background: rgba(67, 56, 202, 0.12); /* Updated to match new secondary color */
    border-color: rgba(67, 56, 202, 0.35);
    color: var(--tpsub-primary-dark);
}

.tpsub-btn-ghost {
    color: var(--tpsub-primary-dark);
    background: rgba(67, 56, 202, 0.08); /* Updated to match new secondary color */
}

.tpsub-btn-ghost:hover {
    background: rgba(67, 56, 202, 0.16); /* Updated to match new secondary color */
    color: var(--tpsub-primary-dark);
}

/* Stats */
.tpsub-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
    margin: 40px 0 48px;
}

.tpsub-stat-card {
    position: relative;
    padding: 28px 26px;
    border-radius: var(--tpsub-radius);
    background: var(--tpsub-surface);
    border: 1px solid rgba(226, 232, 240, 0.75);
    box-shadow: var(--tpsub-shadow-xs);
    overflow: hidden;
    transition: transform var(--tpsub-transition), box-shadow var(--tpsub-transition);
}

.tpsub-stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--tpsub-shadow-sm);
}

/* Clickable stat cards */
.tpsub-stat-card-clickable {
    cursor: pointer;
    user-select: none;
}

.tpsub-stat-card-clickable:hover {
    transform: translateY(-6px);
    box-shadow: var(--tpsub-shadow-sm);
}

.tpsub-stat-card-clickable:active {
    transform: translateY(-2px);
}

.tpsub-stat-accent {
    position: absolute;
    inset: 0;
    height: 4px;
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.75), rgba(99, 102, 241, 0.75));
    border-radius: var(--tpsub-radius) var(--tpsub-radius) 0 0;
}

.tpsub-stat-content {
    display: flex;
    align-items: center;
    gap: 22px;
}

.tpsub-stat-value {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--tpsub-primary);
    letter-spacing: -0.02em;
}

.tpsub-stat-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tpsub-stat-label {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--tpsub-muted);
    letter-spacing: 0.18em;
}

.tpsub-stat-limit {
    font-size: 0.85rem;
    color: var(--tpsub-primary-dark);
    font-weight: 500;
}

/* Sections */
.tpsub-section {
    margin-top: 48px;
}

.tpsub-section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.tpsub-section-heading h2 {
    margin: 0;
    font-size: 1.65rem;
    letter-spacing: -0.015em;
}

.tpsub-section-subtitle {
    margin: 4px 0 0;
    color: var(--tpsub-muted);
    font-size: 0.98rem;
}

.tpsub-card {
    border-radius: var(--tpsub-radius);
    background: var(--tpsub-surface);
    border: 1px solid rgba(226, 232, 240, 0.7);
    padding: 28px 30px;
    box-shadow: var(--tpsub-shadow-xs);
}

/* Workspace Header */
.tpsub-workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    flex-wrap: wrap;
}

.tpsub-workspace-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.tpsub-stat-inline {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.tpsub-stat-value-lg {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tpsub-primary);
}

.tpsub-stat-label-sm {
    font-size: 0.875rem;
    color: var(--tpsub-muted);
}

/* Preferences */
.tpsub-preferences-card {
    padding-top: 18px;
}

.tpsub-preferences-tabs {
    display: inline-flex;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 999px;
    padding: 5px;
    margin-bottom: 24px;
}

.tpsub-workspace-tabs {
    display: flex;
    gap: 8px;
    padding: 0;
    margin: 0 0 16px 0;
    border-bottom: 1px solid var(--tpsub-border);
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    padding: 8px 12px;
}

.tpsub-tab-btn {
    border: none;
    background: transparent;
    color: var(--tpsub-muted);
    font-weight: 600;
    font-size: 14px;
    padding: 10px 22px;
    border-radius: 999px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background var(--tpsub-transition), color var(--tpsub-transition);
}

.tpsub-tab-btn svg {
    flex-shrink: 0;
}

.tpsub-tab-btn:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--tpsub-primary);
}

.tpsub-tab-btn.active {
    background: var(--tpsub-surface);
    color: var(--tpsub-primary-dark);
    box-shadow: 0 10px 25px -15px rgba(99, 102, 241, 0.75);
}

.tpsub-tab-content {
    display: none;
}

.tpsub-tab-content.active {
    display: block;
    animation: fadeIn var(--tpsub-transition);
}

.tpsub-workspace-tab-content {
    display: block;
}

.tpsub-tab-panel {
    display: none;
}

.tpsub-tab-panel.active {
    display: block;
    animation: fadeIn var(--tpsub-transition);
}

.tpsub-preference-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.tpsub-preference-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    border-radius: var(--tpsub-radius-sm);
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.tpsub-preference-label {
    font-weight: 600;
    color: var(--tpsub-primary-dark);
}

.tpsub-remove-preference {
    border: none;
    background: transparent;
    color: var(--tpsub-primary);
    font-weight: 600;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background var(--tpsub-transition), color var(--tpsub-transition);
}

.tpsub-remove-preference:hover {
    background: rgba(99, 102, 241, 0.12);
    color: var(--tpsub-primary-dark);
}

.tpsub-tab-footer {
    margin-top: 20px;
    text-align: right;
}

.tpsub-empty-state {
    text-align: center;
    padding: 60px 32px;
    border-radius: var(--tpsub-radius-sm);
    background: rgba(15, 23, 42, 0.035);
    border: 1px dashed rgba(99, 102, 241, 0.2);
}

.tpsub-empty-state svg {
    margin-bottom: 24px;
    opacity: 0.7;
}

.tpsub-empty-state h3 {
    margin: 0 0 12px;
    font-size: 1.25rem;
    font-weight: 600;
}

.tpsub-empty-state p {
    margin: 0 0 28px;
    color: var(--tpsub-muted);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.tpsub-empty-state .tpsub-btn {
    min-width: 200px;
}

/* Tender list */
.tpsub-tenders-list,
.tpsub-starred-list {
    display: grid;
    gap: 20px;
}

.tpsub-tender-item {
    position: relative;
    border: 1px solid rgba(226, 232, 240, 0.7);
    border-radius: var(--tpsub-radius);
    padding: 26px 28px 26px 64px; /* Extra left padding for checkbox */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    box-shadow: var(--tpsub-shadow-xs);
    transition: transform var(--tpsub-transition), box-shadow var(--tpsub-transition);
}

.tpsub-tender-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--tpsub-shadow-sm);
}

.tpsub-tender-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.tpsub-tender-title-section {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

/* Checkbox in Tender List */
.tpsub-tender-checkbox {
    position: absolute;
    left: 24px;
    top: 32px;
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--tpsub-primary);
    z-index: 10;
}

.tpsub-tender-checkbox:hover {
    transform: scale(1.15);
}

/* Star Button in Tender List */
.tpsub-tender-item .tpsub-star-btn {
    background: transparent;
    border: 2px solid var(--tpsub-border);
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--tpsub-transition);
    flex-shrink: 0;
}

.tpsub-tender-item .tpsub-star-btn:hover {
    border-color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    transform: scale(1.1);
}

.tpsub-tender-item .tpsub-star-btn.starred {
    background: #fbbf24;
    border-color: #fbbf24;
}

.tpsub-tender-item .tpsub-star-btn.starred:hover {
    background: #f59e0b;
    border-color: #f59e0b;
}

.tpsub-star-icon {
    display: block;
    width: 18px;
    height: 18px;
    position: relative;
}

.tpsub-star-icon::before {
    content: "★";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    line-height: 1;
    color: var(--tpsub-muted);
    transition: color var(--tpsub-transition);
}

.tpsub-star-btn:hover .tpsub-star-icon::before {
    color: #fbbf24;
}

.tpsub-star-btn.starred .tpsub-star-icon::before {
    color: white;
}

.tpsub-tender-title {
    margin: 0;
    font-size: 1.2rem;
}

.tpsub-tender-title a {
    color: var(--tpsub-text);
    text-decoration: none;
    transition: color var(--tpsub-transition);
}

.tpsub-tender-title a:hover {
    color: var(--tpsub-primary);
}

.tpsub-tender-reference {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.9rem;
    color: var(--tpsub-muted);
}

.tpsub-tender-badges {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
}

.tpsub-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tpsub-badge-type {
    background: rgba(99, 102, 241, 0.12);
    color: var(--tpsub-primary-dark);
}

.tpsub-badge-open,
.tpsub-badge-live,
.tpsub-badge-active {
    background: rgba(16, 185, 129, 0.18);
    color: #0f766e;
}

.tpsub-badge-closed {
    background: rgba(239, 68, 68, 0.16);
    color: #b91c1c;
}

.tpsub-badge-unknown {
    background: rgba(100, 116, 139, 0.18);
    color: var(--tpsub-muted);
}

.tpsub-tender-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
    color: var(--tpsub-muted);
    font-size: 0.92rem;
    margin-bottom: 22px;
}

.tpsub-meta-item strong {
    color: var(--tpsub-text);
    margin-right: 6px;
}

.tpsub-days-remaining {
    color: var(--tpsub-primary);
    font-weight: 600;
    margin-left: 6px;
}

.tpsub-tender-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Links */
.tpsub-link {
    color: var(--tpsub-primary);
    font-weight: 600;
    text-decoration: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color var(--tpsub-transition);
}

.tpsub-link::after {
    content: "";
    width: 12px;
    height: 12px;
    background: currentColor;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="none"><path fill="%23fff" d="M11.667 4.167h4.166v4.166h-1.666V6.25L9.917 10.5l-1.178-1.178L13.99 5.833h-2.323V4.167Zm2.5 11.666H5.833c-.46 0-.833-.373-.833-.833V5c0-.46.373-.833.833-.833h4.167v1.666H6.667v9.167h7.5v-3.333h1.667v3.333c0 .46-.373.833-.834.833Z"/></svg>') center/contain no-repeat;
    transition: transform var(--tpsub-transition);
}

.tpsub-link:hover {
    color: var(--tpsub-primary-dark);
}

.tpsub-link:hover::after {
    transform: translateX(3px);
}

/* Viewed list */
.tpsub-viewed-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

.tpsub-viewed-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--tpsub-radius-sm);
    border: 1px solid rgba(226, 232, 240, 0.7);
    background: rgba(248, 250, 252, 0.9);
}

.tpsub-viewed-meta {
    color: var(--tpsub-muted);
    font-size: 0.85rem;
}

/* ========================================
   Browse Tenders Page - Improved Layout
   ======================================== */

/* List Header */
.tpsub-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.tpsub-header-left {
    display: flex;
    align-items: baseline;
    gap: 16px;
    flex-wrap: wrap;
}

.tpsub-header-left h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--tpsub-text);
}

.tpsub-results-count {
    font-size: 14px;
    color: var(--tpsub-muted);
    font-weight: 500;
}

.tpsub-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Filters Toggle Button */
.tpsub-toggle-filters-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--tpsub-surface);
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    color: var(--tpsub-text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--tpsub-transition);
}

.tpsub-toggle-filters-btn:hover {
    background: var(--tpsub-background);
    border-color: var(--tpsub-primary);
    color: var(--tpsub-primary);
    transform: translateY(-1px);
    box-shadow: var(--tpsub-shadow-xs);
}

.tpsub-toggle-filters-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Tender list layout */
.tpsub-tender-list {
    display: flex;
    gap: 24px;
    position: relative;
}

/* Filters Panel - Slide-in from left */
.tpsub-filters {
    position: fixed;
    left: -320px;
    top: 0;
    bottom: 0;
    width: 320px;
    max-width: 90vw;
    background: var(--tpsub-surface);
    padding: 0;
    border-right: 1px solid var(--tpsub-border);
    box-shadow: 2px 0 20px rgba(15, 23, 42, 0.1);
    z-index: 10000;
    overflow-y: auto;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tpsub-filters.active {
    left: 0;
}

/* Filters Header */
.tpsub-filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--tpsub-border);
    position: sticky;
    top: 0;
    background: var(--tpsub-surface);
    z-index: 10;
}

.tpsub-filters-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--tpsub-text);
}

.tpsub-close-filters-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--tpsub-muted);
    border-radius: 6px;
    transition: all var(--tpsub-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpsub-close-filters-btn:hover {
    background: var(--tpsub-background);
    color: var(--tpsub-text);
}

.tpsub-close-filters-btn .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Filter Form */
#tpsub-filter-form {
    padding: 24px;
}

.tpsub-filter-group {
    margin-bottom: 24px;
}

.tpsub-filter-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--tpsub-text);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tpsub-filter-group input[type="text"],
.tpsub-filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    font-size: 14px;
    transition: all var(--tpsub-transition);
}

.tpsub-filter-group input[type="text"]:focus,
.tpsub-filter-group select:focus {
    outline: none;
    border-color: var(--tpsub-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.tpsub-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 14px;
    color: var(--tpsub-text);
    cursor: pointer;
}

.tpsub-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.tpsub-filter-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--tpsub-border);
}

.tpsub-filter-actions .button {
    flex: 1;
    padding: 10px 20px;
    border-radius: var(--tpsub-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--tpsub-transition);
    border: none;
    text-align: center;
}

.tpsub-filter-actions .button-primary {
    background: var(--tpsub-primary);
    color: white;
}

.tpsub-filter-actions .button-primary:hover {
    background: var(--tpsub-primary-dark);
}

/* Overlay when filters are open */
body.tpsub-filters-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.tpsub-tenders {
    flex: 1;
    max-width: 100%;
}

/* Quick Filters at top of browse page */
.tpsub-quick-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tpsub-quick-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--tpsub-surface);
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    color: var(--tpsub-text);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--tpsub-transition);
}

.tpsub-quick-filter .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tpsub-quick-filter:hover,
.tpsub-btn-outline.tpsub-quick-filter:hover {
    background: var(--tpsub-primary) !important;
    border-color: var(--tpsub-primary) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: var(--tpsub-shadow-xs);
}

.tpsub-quick-filter.active {
    background: var(--tpsub-primary);
    border-color: var(--tpsub-primary);
    color: white;
}

.tpsub-quick-filter .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: inherit !important;
}

/* Bulk Actions */
.tpsub-bulk-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    background: var(--tpsub-background);
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    margin-bottom: 24px;
}

.tpsub-select-all-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--tpsub-text);
    font-size: 14px;
}

.tpsub-select-all-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.tpsub-bulk-email {
    white-space: nowrap;
}

.tpsub-bulk-email .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Loading Spinner */
.tpsub-loading {
    text-align: center;
    padding: 40px;
}

.tpsub-spinner {
    border: 4px solid rgba(148, 163, 184, 0.25);
    border-top: 4px solid var(--tpsub-primary);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Messages */
.tpsub-error {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    padding: 18px;
    border-radius: var(--tpsub-radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.35);
    margin-bottom: 24px;
}

.tpsub-success {
    background: rgba(16, 185, 129, 0.12);
    color: #0f766e;
    padding: 18px;
    border-radius: var(--tpsub-radius-sm);
    border: 1px solid rgba(16, 185, 129, 0.35);
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 1024px) {
    .tpsub-dashboard {
        padding: 28px 18px 48px;
    }

    .tpsub-welcome-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 32px;
    }

    .tpsub-welcome-content {
        max-width: 100%;
    }

    .tpsub-plan-status {
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    /* Fix header full-width technique on mobile to prevent horizontal scroll */
    .tpsub-browse-page .tp-header,
    .tpsub-dashboard-page .tp-header {
        width: 100%;
        max-width: 100vw;
        left: 0;
        right: 0;
        margin-left: 0;
        margin-right: 0;
    }

    /* Reduce container padding on mobile for better fit */
    .tpsub-browse-page .tp-container,
    .tpsub-dashboard-page .tp-container {
        padding: 0 16px;
    }

    .tpsub-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tpsub-section-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .tpsub-tab-footer {
        text-align: left;
    }

    .tpsub-tender-list {
        flex-direction: column;
    }

    .tpsub-filters {
        width: 90vw;
    }

    /* Explicitly hide inactive filters on mobile */
    .tpsub-filters:not(.active) {
        visibility: hidden;
        pointer-events: none;
    }

    /* Ensure active filters are visible */
    .tpsub-filters.active {
        visibility: visible;
        pointer-events: auto;
    }

    .tpsub-tender-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .tpsub-tender-item {
        padding: 20px 18px 20px 52px; /* Reduced padding on mobile */
    }

    .tpsub-tender-checkbox {
        left: 18px;
        top: 26px;
        width: 18px;
        height: 18px;
    }

    .tpsub-tender-title-section {
        width: 100%;
    }

    /* Ensure badges stay on same line on mobile */
    .tpsub-tender-badges {
        gap: 6px;
        flex-shrink: 0;
    }

    .tpsub-badge {
        padding: 4px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    .tpsub-tender-actions {
        width: 100%;
        flex-direction: column;
    }

    .tpsub-tender-actions .tpsub-btn {
        width: 100%;
    }

    .tpsub-viewed-item {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Browse page mobile adjustments */
    .tpsub-list-header {
        flex-direction: column;
        align-items: stretch;
    }

    .tpsub-header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .tpsub-header-left h1 {
        font-size: 24px;
    }

    .tpsub-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .tpsub-toggle-filters-btn {
        flex: 1;
    }

    .tpsub-bulk-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .tpsub-bulk-email {
        width: 100%;
    }

    .tpsub-quick-filters {
        flex-direction: column;
    }

    .tpsub-quick-filter {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 540px) {
    .tpsub-dashboard {
        padding: 24px 16px 40px;
    }

    .tpsub-welcome-card {
        padding: 26px 24px;
    }

    .tpsub-welcome-title {
        font-size: 1.6rem;
    }

    .tpsub-stats-grid {
        grid-template-columns: 1fr;
    }

    .tpsub-card {
        padding: 22px 20px;
    }

    .tpsub-workspace-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .tpsub-workspace-header .tpsub-btn {
        width: 100%;
        justify-content: center;
    }

    .tpsub-preference-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .tpsub-remove-preference {
        align-self: flex-end;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MODAL STYLES FOR PREFERENCE MANAGEMENT
   ============================================ */

/* Ensure parent containers don't restrict modals */
body:has(.tpsub-modal-overlay.active) {
    overflow: hidden !important;
}

/* Modal Overlay - FULL SCREEN CRITICAL */
.tpsub-modal-overlay,
div.tpsub-modal-overlay {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    min-width: 100vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 20px !important;
    background: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(4px);
    z-index: 999999 !important;
    align-items: center !important;
    justify-content: center !important;
    animation: fadeInOverlay 0.2s ease;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    transform: none !important;
    float: none !important;
    clear: both !important;
}

.tpsub-modal-overlay.active {
    display: flex !important;
    flex-direction: column !important;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal Container */
.tpsub-modal-container {
    background: var(--tpsub-surface);
    border-radius: var(--tpsub-radius);
    box-shadow: var(--tpsub-shadow);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    margin: auto;
    box-sizing: border-box;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.tpsub-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid var(--tpsub-border);
}

.tpsub-modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--tpsub-text);
}

.tpsub-modal-close {
    cursor: pointer;
    transition: all var(--tpsub-transition);
}

/* Icon-only close button (× in header) */
.tpsub-modal-header .tpsub-modal-close {
    background: none;
    border: none !important;
    font-size: 32px;
    line-height: 1;
    color: #6B7280;
    padding: 0 !important;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
    opacity: 1 !important;
    visibility: visible !important;
    text-indent: 0;
    overflow: visible;
}

.tpsub-modal-header .tpsub-modal-close:hover {
    background: #F3F4F6;
    color: #111827;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Text button in footer - let button classes handle styling */
.tpsub-modal-footer .tpsub-modal-close.tpsub-btn {
    width: auto !important;
    height: auto !important;
    font-size: inherit !important;
    line-height: inherit !important;
    padding: 14px 28px !important;
    min-width: auto !important;
    min-height: auto !important;
    display: inline-flex !important;
}

/* Modal Body */
.tpsub-modal-body {
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}

.tpsub-modal-body::-webkit-scrollbar {
    width: 8px;
}

.tpsub-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.tpsub-modal-body::-webkit-scrollbar-thumb {
    background: var(--tpsub-border);
    border-radius: 4px;
}

.tpsub-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--tpsub-muted);
}

/* Modal Footer */
.tpsub-modal-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--tpsub-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Modal Sections */
.tpsub-modal-section {
    margin-bottom: 32px;
}

.tpsub-modal-section:last-child {
    margin-bottom: 0;
}

.tpsub-modal-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--tpsub-text);
    margin: 0 0 16px 0;
}

/* Loading Message */
.tpsub-loading-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--tpsub-muted);
    font-size: 14px;
}

.tpsub-loading-message .dashicons {
    display: inline-block;
    animation: tpsub-spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes tpsub-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.tpsub-error-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--tpsub-error);
    font-size: 14px;
}

/* Limit Indicator */
.tpsub-limit-indicator {
    background: var(--tpsub-background);
    border-radius: var(--tpsub-radius-sm);
    padding: 16px;
    margin-bottom: 24px;
}

.tpsub-limit-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.tpsub-limit-count {
    font-size: 24px;
    font-weight: 700;
    color: var(--tpsub-text);
}

.tpsub-limit-label {
    font-size: 14px;
    color: var(--tpsub-muted);
}

.tpsub-progress-bar {
    height: 6px;
    background: var(--tpsub-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.tpsub-progress-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.tpsub-upgrade-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--tpsub-muted);
}

.tpsub-pro-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tpsub-link-small {
    color: var(--tpsub-primary);
    text-decoration: none;
    font-weight: 500;
}

.tpsub-link-small:hover {
    text-decoration: underline;
}

/* Help Box */
.tpsub-help-box {
    display: flex;
    gap: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--tpsub-radius-sm);
    padding: 16px;
    margin-bottom: 24px;
}

.tpsub-help-box .dashicons {
    color: #3b82f6;
    font-size: 20px;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.tpsub-help-box strong {
    display: block;
    margin-bottom: 4px;
    color: var(--tpsub-text);
}

.tpsub-help-box p {
    margin: 0;
    font-size: 14px;
    color: var(--tpsub-muted);
    line-height: 1.5;
}

/* Empty State */
.tpsub-empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--tpsub-muted);
    font-size: 14px;
}

/* Preference List - Compact */
.tpsub-preference-list-compact {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tpsub-preference-list-compact .tpsub-preference-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    margin-bottom: 8px;
    transition: all var(--tpsub-transition);
}

.tpsub-preference-list-compact .tpsub-preference-item:hover {
    border-color: var(--tpsub-primary);
    background: var(--tpsub-background);
}

.tpsub-preference-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.tpsub-preference-value {
    flex: 1;
    font-size: 14px;
    color: var(--tpsub-text);
    font-weight: 500;
}

.tpsub-preference-remove {
    background: none;
    border: none;
    color: var(--tpsub-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--tpsub-transition);
}

.tpsub-preference-remove:hover {
    background: var(--tpsub-error);
    color: white;
}

.tpsub-preference-remove svg {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* Search Box */
.tpsub-search-box {
    position: relative;
    margin-bottom: 16px;
}

.tpsub-search-box .dashicons {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tpsub-muted);
    width: 20px;
    height: 20px;
    font-size: 20px;
}

.tpsub-search-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    font-size: 14px;
    transition: all var(--tpsub-transition);
}

.tpsub-search-input:focus {
    outline: none;
    border-color: var(--tpsub-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

/* Form Elements */
.tpsub-form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (min-width: 640px) {
    .tpsub-form-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

.tpsub-form-field {
    margin-bottom: 20px;
}

.tpsub-form-field:last-child {
    margin-bottom: 0;
}

.tpsub-form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--tpsub-text);
    margin-bottom: 6px;
}

.tpsub-form-field label .required {
    color: var(--tpsub-error);
}

.tpsub-form-field label .optional {
    font-weight: 400;
    color: var(--tpsub-muted);
}

.tpsub-select,
.tpsub-input,
.tpsub-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--tpsub-transition);
}

.tpsub-textarea {
    resize: vertical;
    min-height: 100px;
}

.tpsub-select:focus,
.tpsub-input:focus,
.tpsub-textarea:focus {
    outline: none;
    border-color: var(--tpsub-primary);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.tpsub-select:disabled,
.tpsub-input:disabled,
.tpsub-textarea:disabled {
    background: var(--tpsub-background);
    cursor: not-allowed;
}

/* Location Preview */
.tpsub-location-preview {
    background: var(--tpsub-background);
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.tpsub-preview-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--tpsub-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.tpsub-location-breadcrumb {
    font-size: 14px;
    color: var(--tpsub-text);
    font-weight: 500;
}

/* Buttons */
.tpsub-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--tpsub-radius-sm);
    cursor: pointer;
    transition: all var(--tpsub-transition);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tpsub-btn-primary {
    background: var(--tpsub-primary);
    color: white;
}

.tpsub-btn-primary:hover {
    background: var(--tpsub-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--tpsub-shadow-xs);
}

.tpsub-btn-primary:disabled {
    background: var(--tpsub-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tpsub-btn-secondary {
    background: var(--tpsub-secondary);
    color: white;
}

.tpsub-btn-secondary:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

.tpsub-btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.tpsub-btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
    transform: translateY(-1px);
}

.tpsub-btn-small {
    padding: 6px 14px;
    font-size: 13px;
}

/* Sectors Grid */
.tpsub-sectors-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 2px;
}

@media (min-width: 640px) {
    .tpsub-sectors-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.tpsub-sector-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    cursor: pointer;
    transition: all var(--tpsub-transition);
}

.tpsub-sector-card:hover {
    border-color: var(--tpsub-primary);
    background: var(--tpsub-background);
}

.tpsub-sector-card.selected {
    background: #eff6ff;
    border-color: var(--tpsub-primary);
}

.tpsub-sector-card-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tpsub-sector-icon {
    font-size: 18px;
}

.tpsub-sector-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--tpsub-text);
}

.tpsub-sector-checkmark {
    color: var(--tpsub-primary);
    font-size: 18px;
    font-weight: 700;
}

.tpsub-sector-add-btn {
    background: var(--tpsub-primary);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: all var(--tpsub-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpsub-sector-add-btn:hover {
    background: var(--tpsub-primary-dark);
    transform: scale(1.1);
}

/* Keywords */
.tpsub-keywords-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tpsub-keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--tpsub-background);
    border: 1px solid var(--tpsub-border);
    border-radius: 20px;
    font-size: 14px;
    color: var(--tpsub-text);
    transition: all var(--tpsub-transition);
}

.tpsub-keyword-text {
    font-weight: 500;
}

.tpsub-keyword-remove {
    background: none;
    border: none;
    color: var(--tpsub-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--tpsub-transition);
}

.tpsub-keyword-remove:hover {
    background: var(--tpsub-error);
    color: white;
}

.tpsub-keyword-form {
    margin-bottom: 24px;
}

.tpsub-keyword-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.tpsub-keyword-input-group .tpsub-input {
    flex: 1;
}

.tpsub-form-hint {
    font-size: 13px;
    color: var(--tpsub-muted);
    margin: 0;
}

.tpsub-popular-keywords h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--tpsub-text);
    margin: 0 0 12px 0;
}

.tpsub-popular-keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tpsub-popular-keyword-btn {
    padding: 6px 14px;
    background: white;
    border: 1px solid var(--tpsub-border);
    border-radius: 16px;
    font-size: 13px;
    color: var(--tpsub-text);
    cursor: pointer;
    transition: all var(--tpsub-transition);
}

.tpsub-popular-keyword-btn:hover {
    background: var(--tpsub-primary);
    color: white;
    border-color: var(--tpsub-primary);
}

/* Organizations */
.tpsub-organizations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.tpsub-organization-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    transition: all var(--tpsub-transition);
}

.tpsub-organization-item:hover {
    border-color: var(--tpsub-primary);
    background: var(--tpsub-background);
}

.tpsub-organization-item.following {
    background: #eff6ff;
    border-color: var(--tpsub-primary);
}

.tpsub-organization-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.tpsub-org-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.tpsub-org-details {
    flex: 1;
}

.tpsub-org-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--tpsub-text);
    margin-bottom: 2px;
}

.tpsub-org-meta {
    font-size: 12px;
    color: var(--tpsub-muted);
}

.tpsub-following-badge {
    font-size: 12px;
    font-weight: 600;
    color: var(--tpsub-primary);
    padding: 4px 12px;
    background: #eff6ff;
    border-radius: 12px;
}

/* Limit Message */
.tpsub-limit-message {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: var(--tpsub-radius-sm);
    align-items: flex-start;
}

.tpsub-limit-message-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.tpsub-limit-message strong {
    display: block;
    margin-bottom: 6px;
    color: var(--tpsub-text);
}

.tpsub-limit-message p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--tpsub-muted);
}

.tpsub-no-results {
    text-align: center;
    padding: 32px;
    color: var(--tpsub-muted);
    font-size: 14px;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
    .tpsub-modal-header,
    .tpsub-modal-body,
    .tpsub-modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .tpsub-modal-header h2 {
        font-size: 20px;
    }

    .tpsub-keyword-input-group {
        flex-direction: column;
    }

    .tpsub-organization-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .tpsub-following-badge,
    .tpsub-follow-org-btn {
        align-self: stretch;
    }
}


/* ========================================
   Toast Notifications
   ======================================== */

.tpsub-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    background: var(--tpsub-success);
    color: white;
    border-radius: var(--tpsub-radius-sm);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 999999;
    box-shadow: var(--tpsub-shadow-sm);
    font-size: 14px;
    font-weight: 500;
}

.tpsub-toast-show {
    opacity: 1;
    transform: translateY(0);
}

.tpsub-toast-success {
    background: var(--tpsub-success);
}

.tpsub-toast-error {
    background: var(--tpsub-error);
}

.tpsub-toast-warning {
    background: var(--tpsub-warning);
}

/* ========================================
   Dashboard Stat Animation
   ======================================== */

.tpsub-stat-updated {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* ========================================
   New Item Animation
   ======================================== */

.tpsub-new-item {
    background: #f0f9ff;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}


/* ========================================
   Tender Detail Page
   ======================================== */


.tpsub-detail-page {
    background: var(--tpsub-background);
    min-height: 100vh;
}

.tpsub-tender-detail {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.tpsub-detail-header {
    background: var(--tpsub-surface);
    border-radius: var(--tpsub-radius);
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: var(--tpsub-shadow-xs);
}

.tpsub-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.tpsub-reference {
    font-size: 14px;
    font-weight: 600;
    color: var(--tpsub-muted);
    padding: 6px 14px;
    background: var(--tpsub-background);
    border-radius: 20px;
}

.tpsub-header-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tpsub-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tpsub-badge-type {
    background: #e0e7ff;
    color: #4338ca;
}

.tpsub-badge-open {
    background: #d1fae5;
    color: #065f46;
}

.tpsub-badge-closed {
    background: #fee2e2;
    color: #991b1b;
}

.tpsub-detail-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--tpsub-text);
    margin: 0 0 24px 0;
    line-height: 1.3;
}

.tpsub-header-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tpsub-star-btn,
.tpsub-send-email-btn,
.tpsub-share-btn {
    padding: 12px 24px;
    border-radius: var(--tpsub-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--tpsub-transition);
    border: none;
    white-space: nowrap;
}

.tpsub-star-btn {
    background: var(--tpsub-primary);
    color: white;
}

.tpsub-star-btn:hover {
    background: var(--tpsub-primary-dark);
    transform: translateY(-2px);
}

.tpsub-star-btn.starred {
    background: #fbbf24;
}

.tpsub-send-email-btn {
    background: var(--tpsub-secondary);
    color: white;
}

.tpsub-send-email-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.tpsub-share-btn {
    background: var(--tpsub-background);
    color: var(--tpsub-text);
    border: 1px solid var(--tpsub-border);
}

.tpsub-share-btn:hover {
    background: white;
    transform: translateY(-2px);
}

.tpsub-ai-workspace-btn {
    padding: 12px 24px;
    border-radius: var(--tpsub-radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--tpsub-transition);
    border: none;
    white-space: nowrap;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.tpsub-ai-workspace-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    color: white;
    text-decoration: none;
}

.tpsub-ai-workspace-btn.tpsub-upgrade-prompt {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    opacity: 0.8;
}

.tpsub-ai-workspace-btn.tpsub-upgrade-prompt:hover {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    opacity: 1;
}

.tpsub-pro-badge {
    background: #fbbf24;
    color: #78350f;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-left: 4px;
}

.tpsub-detail-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.tpsub-info-panel,
.tpsub-dates-panel,
.tpsub-description-panel,
.tpsub-briefing-panel,
.tpsub-contact-panel,
.tpsub-links-panel {
    background: var(--tpsub-surface);
    border-radius: var(--tpsub-radius);
    padding: 24px;
    box-shadow: var(--tpsub-shadow-xs);
}

.tpsub-detail-content h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--tpsub-text);
    margin: 0 0 20px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--tpsub-background);
}

.tpsub-info-list,
.tpsub-dates-list {
    margin: 0;
}

.tpsub-info-list dt,
.tpsub-dates-list dt {
    font-size: 13px;
    font-weight: 600;
    color: var(--tpsub-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    margin-top: 16px;
}

.tpsub-info-list dt:first-of-type,
.tpsub-dates-list dt:first-of-type {
    margin-top: 0;
}

.tpsub-info-list dd,
.tpsub-dates-list dd {
    font-size: 15px;
    font-weight: 500;
    color: var(--tpsub-text);
    margin: 0 0 12px 0;
}

.tpsub-closing-date-highlight {
    color: var(--tpsub-primary);
    font-weight: 600;
}

.tpsub-countdown {
    display: inline-block;
    margin-left: 8px;
    padding: 4px 10px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.tpsub-description-panel,
.tpsub-briefing-panel {
    grid-column: 1 / -1;
}

.tpsub-description-content,
.tpsub-briefing-content,
.tpsub-contact-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--tpsub-text);
}

.tpsub-description-content p,
.tpsub-briefing-content p,
.tpsub-contact-content p {
    margin: 0;
}

.tpsub-links-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tpsub-links-list li {
    margin-bottom: 12px;
}

.tpsub-links-list a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: var(--tpsub-background);
    border-radius: var(--tpsub-radius-sm);
    color: var(--tpsub-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--tpsub-transition);
}

.tpsub-links-list a:hover {
    background: var(--tpsub-primary);
    color: white;
    transform: translateX(4px);
}

.tpsub-back-link {
    margin-top: 32px;
}

.tpsub-back-link .button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--tpsub-background);
    color: var(--tpsub-text);
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--tpsub-transition);
}

.tpsub-back-link .button:hover {
    background: white;
    transform: translateX(-4px);
}

@media (max-width: 768px) {
    .tpsub-tender-detail {
        padding: 24px 16px;
    }
    .tpsub-detail-header {
        padding: 24px;
    }
    .tpsub-detail-title {
        font-size: 22px;
    }
    .tpsub-header-actions {
        width: 100%;
    }
    .tpsub-star-btn,
    .tpsub-send-email-btn,
    .tpsub-share-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }
    .tpsub-detail-content {
        grid-template-columns: 1fr;
    }
    .tpsub-info-panel,
    .tpsub-dates-panel,
    .tpsub-description-panel,
    .tpsub-briefing-panel,
    .tpsub-contact-panel,
    .tpsub-links-panel {
        padding: 20px;
    }
}

/* ========================================
   Dashboard Workspace Cards Section
   ======================================== */

.tpsub-workspaces-section {
    margin-top: 24px;
}

.tpsub-workspaces-section .tpsub-section-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--tpsub-text);
    margin: 0 0 16px 0;
    padding: 0;
}

/* Dashboard-specific grid - 2 columns on desktop, 1 on mobile */
.tpsub-workspaces-grid-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

/* Ensure workspace cards display properly on dashboard */
.tpsub-workspaces-section .tpsub-workspace-card {
    display: flex;
    flex-direction: column;
    background: white;
    border: 1px solid var(--tpsub-border);
    border-radius: 10px;
    overflow: hidden;
    transition: all var(--tpsub-transition);
    box-shadow: var(--tpsub-shadow-xs);
}

.tpsub-workspaces-section .tpsub-workspace-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--tpsub-shadow-sm);
    border-color: var(--tpsub-primary);
}

.tpsub-workspaces-section .tpsub-workspace-card-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--tpsub-border);
}

.tpsub-workspaces-section .tpsub-workspace-card-body {
    padding: 12px 16px;
    flex: 1;
}

.tpsub-workspaces-section .tpsub-workspace-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
}

.tpsub-workspaces-section .tpsub-workspace-card-title a {
    color: var(--tpsub-text);
    text-decoration: none;
    transition: color var(--tpsub-transition);
}

.tpsub-workspaces-section .tpsub-workspace-card-title a:hover {
    color: var(--tpsub-primary);
}

.tpsub-workspaces-section .tpsub-workspace-tender-ref {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--tpsub-muted);
    margin: 0 0 10px 0;
}

.tpsub-workspaces-section .tpsub-workspace-card-excerpt {
    font-size: 13px;
    color: var(--tpsub-muted);
    line-height: 1.4;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tpsub-workspaces-section .tpsub-workspace-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--tpsub-muted);
    flex-wrap: wrap;
    margin: 0;
}

.tpsub-workspaces-section .tpsub-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tpsub-workspaces-section .tpsub-workspace-card-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--tpsub-border);
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tpsub-workspaces-section .tpsub-workspace-card-footer .tpsub-btn {
    text-decoration: none;
}

.tpsub-workspaces-section .tpsub-workspace-card-footer .tpsub-btn:hover {
    text-decoration: none;
}

.tpsub-workspaces-section .tpsub-status-badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 10px;
    text-transform: capitalize;
    line-height: 1.4;
}

.tpsub-workspaces-section .tpsub-status-badge.tpsub-status-draft {
    background: #fef3c7;
    color: #92400e;
}

.tpsub-workspaces-section .tpsub-status-badge.tpsub-status-review {
    background: #fed7aa;
    color: #9a3412;
}

.tpsub-workspaces-section .tpsub-status-badge.tpsub-status-submitted {
    background: #dbeafe;
    color: #1e40af;
}

.tpsub-workspaces-section .tpsub-status-badge.tpsub-status-archive {
    background: #f1f5f9;
    color: #475569;
}

/* Legacy status support (for backwards compatibility) */
.tpsub-workspaces-section .tpsub-status-badge.tpsub-status-completed {
    background: #d1fae5;
    color: #065f46;
}

.tpsub-workspaces-section .tpsub-status-badge.tpsub-status-archived {
    background: #f1f5f9;
    color: #475569;
}

.tpsub-workspaces-section .tpsub-workspace-footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--tpsub-border);
    text-align: center;
}

.tpsub-workspaces-section .tpsub-workspace-footer .tpsub-link {
    color: var(--tpsub-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--tpsub-transition);
}

.tpsub-workspaces-section .tpsub-workspace-footer .tpsub-link:hover {
    color: var(--tpsub-primary-dark);
    gap: 10px;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .tpsub-workspaces-grid-dashboard {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .tpsub-workspaces-section .tpsub-workspace-card-meta {
        font-size: 12px;
    }
}


/* ============================================
   DASHBOARD REDESIGN - Compact Grid Layout
   ============================================ */

/* Compact Header Bar */
.tpsub-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 28px;
    border-radius: var(--tpsub-radius);
    background: linear-gradient(135deg, #f8f9fb 0%, #ffffff 100%);
    border: 1px solid rgba(226, 232, 240, 0.7);
    margin-bottom: 24px;
}

.tpsub-header-greeting {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tpsub-header-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--tpsub-text);
}

.tpsub-tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.tpsub-tier-badge.tpsub-tier-free {
    background: rgba(100, 116, 139, 0.1);
    color: var(--tpsub-muted);
}

.tpsub-tier-badge.tpsub-tier-pro {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(251, 191, 36, 0.15));
    color: #f59e0b;
}

.tpsub-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Dashboard Grid Layout */
.tpsub-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    margin-top: 32px;
}

.tpsub-dashboard-main {
    min-width: 0;
}

.tpsub-dashboard-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Tabbed Tender Card */
.tpsub-tenders-tabbed-card {
    border-radius: var(--tpsub-radius);
    background: var(--tpsub-surface);
    border: 1px solid rgba(226, 232, 240, 0.7);
    box-shadow: var(--tpsub-shadow-xs);
    overflow: hidden;
}

.tpsub-tab-panel {
    display: none;
    padding: 20px;
}

.tpsub-tab-panel.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.tpsub-tenders-compact .tpsub-tender-item {
    margin-bottom: 12px;
    padding: 14px;
}

.tpsub-tenders-compact .tpsub-tender-item:last-child {
    margin-bottom: 0;
}

.tpsub-empty-compact {
    padding: 32px 20px;
    text-align: center;
}

.tpsub-empty-compact svg {
    opacity: 0.2;
    margin-bottom: 12px;
}

.tpsub-empty-compact h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
}

.tpsub-empty-compact p {
    margin: 0;
    color: var(--tpsub-muted);
    font-size: 0.95rem;
}

.tpsub-tab-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
    text-align: center;
}

.tpsub-link {
    color: var(--tpsub-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--tpsub-transition);
}

.tpsub-link:hover {
    color: var(--tpsub-primary-dark);
    gap: 10px;
}

/* Compact Preferences Card */
.tpsub-preferences-compact {
    padding: 20px;
}

.tpsub-sidebar-title {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.tpsub-preference-group {
    margin-bottom: 12px;
}

.tpsub-preference-group:last-child {
    margin-bottom: 0;
}

.tpsub-preference-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.tpsub-preference-group-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tpsub-muted);
}

.tpsub-btn-icon {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--tpsub-muted);
    border-radius: 6px;
    transition: all var(--tpsub-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tpsub-btn-icon:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--tpsub-primary);
}

.tpsub-preference-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tpsub-chip {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.08);
    color: var(--tpsub-primary-dark);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.tpsub-chip.tpsub-chip-more {
    background: rgba(100, 116, 139, 0.08);
    color: var(--tpsub-muted);
    border-color: rgba(100, 116, 139, 0.15);
}

.tpsub-preference-empty {
    margin: 0;
    color: var(--tpsub-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* Compact Workspace Card */
.tpsub-workspace-compact {
    padding: 20px;
}

.tpsub-sidebar-header {
    margin-bottom: 16px;
}

.tpsub-sidebar-header .tpsub-sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.tpsub-sidebar-header .tpsub-sidebar-title a:hover {
    opacity: 0.8;
    cursor: pointer;
}

.tpsub-pro-badge-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.15);
    font-size: 0.7rem;
    font-weight: 600;
    color: #f59e0b;
    letter-spacing: 0.02em;
}

.tpsub-pro-badge-sm .tpsub-pro-icon {
    width: 12px;
    height: 12px;
}

.tpsub-feature-locked-compact {
    text-align: center;
    padding: 24px 16px;
}

.tpsub-lock-icon-sm {
    margin: 0 auto 12px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(100, 116, 139, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tpsub-muted);
}

.tpsub-lock-text {
    margin: 0 0 16px;
    color: var(--tpsub-muted);
    font-size: 0.95rem;
}

.tpsub-workspace-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: var(--tpsub-radius-sm);
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.tpsub-workspace-stat:hover {
    background: rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    cursor: pointer;
}

.tpsub-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--tpsub-primary);
    line-height: 1;
}

.tpsub-stat-text {
    font-size: 0.85rem;
    color: var(--tpsub-muted);
    font-weight: 500;
}

.tpsub-workspace-list-compact {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tpsub-workspace-item-compact {
    display: block;
    padding: 12px;
    border-radius: var(--tpsub-radius-sm);
    background: rgba(99, 102, 241, 0.04);
    border: 1px solid rgba(99, 102, 241, 0.1);
    text-decoration: none;
    transition: all var(--tpsub-transition);
}

.tpsub-workspace-item-compact:hover {
    background: rgba(99, 102, 241, 0.08);
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateX(2px);
}

.tpsub-workspace-item-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tpsub-text);
    margin-bottom: 4px;
}

.tpsub-workspace-item-meta {
    font-size: 0.75rem;
    color: var(--tpsub-muted);
}

/* Button Variants */
.tpsub-btn-sm {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.tpsub-btn-block {
    width: 100%;
    justify-content: center;
}

.tpsub-btn-ghost {
    background: rgba(99, 102, 241, 0.08);
    color: var(--tpsub-primary-dark);
}

.tpsub-btn-ghost:hover {
    background: rgba(99, 102, 241, 0.15);
    transform: translateY(-1px);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Behavior */
@media (max-width: 1024px) {
    .tpsub-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .tpsub-dashboard-sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .tpsub-header-bar {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 20px;
    }

    .tpsub-header-greeting {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tpsub-header-title {
        font-size: 1.25rem;
    }

    .tpsub-header-actions {
        width: 100%;
        flex-direction: column;
    }

    .tpsub-header-actions .tpsub-btn {
        width: 100%;
    }

    .tpsub-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        margin: 24px 0 32px;
    }

    .tpsub-stat-value {
        font-size: 2rem;
    }

    .tpsub-workspace-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tpsub-workspace-tabs::-webkit-scrollbar {
        display: none;
    }

    .tpsub-tab-btn {
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .tpsub-stats-grid {
        grid-template-columns: 1fr;
    }

    .tpsub-preference-chips {
        gap: 6px;
    }

    .tpsub-chip {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
}

/* ===================================
   PAGINATION & LOAD MORE
   =================================== */

/* Pagination Container */
.tpsub-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 40px 0 30px;
    padding: 20px 0;
}

/* Pagination Links */
.tpsub-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--tpsub-text);
    background: var(--tpsub-surface);
    border: 1px solid var(--tpsub-border);
    border-radius: var(--tpsub-radius-sm);
    text-decoration: none;
    transition: all var(--tpsub-transition);
    cursor: pointer;
}

.tpsub-pagination .page-numbers:hover {
    background: var(--tpsub-background);
    border-color: var(--tpsub-primary);
    color: var(--tpsub-primary);
    transform: translateY(-2px);
    box-shadow: var(--tpsub-shadow-xs);
}

/* Current Page */
.tpsub-pagination .page-numbers.current {
    background: var(--tpsub-primary);
    border-color: var(--tpsub-primary);
    color: white;
    cursor: default;
    font-weight: 600;
}

.tpsub-pagination .page-numbers.current:hover {
    transform: none;
    box-shadow: none;
}

/* Dots */
.tpsub-pagination .page-numbers.dots {
    border: none;
    background: transparent;
    cursor: default;
    color: var(--tpsub-muted);
}

.tpsub-pagination .page-numbers.dots:hover {
    transform: none;
    box-shadow: none;
    background: transparent;
    border: none;
}

/* Previous/Next Buttons */
.tpsub-pagination .page-numbers.prev,
.tpsub-pagination .page-numbers.next {
    font-weight: 600;
    color: var(--tpsub-primary);
}

.tpsub-pagination .page-numbers.prev:hover,
.tpsub-pagination .page-numbers.next:hover {
    background: var(--tpsub-primary);
    color: white;
}

/* Load More Button Wrapper */
.tpsub-load-more-wrapper {
    display: flex;
    justify-content: center;
    margin: 30px 0 40px;
    padding: 20px 0;
}

/* Load More Button */
.tpsub-load-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    font-size: 15px;
    font-weight: 600;
    color: var(--tpsub-primary);
    background: var(--tpsub-surface);
    border: 2px solid var(--tpsub-primary);
    border-radius: var(--tpsub-radius);
    cursor: pointer;
    transition: all var(--tpsub-transition);
    box-shadow: var(--tpsub-shadow-xs);
}

.tpsub-load-more:hover {
    background: var(--tpsub-primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: var(--tpsub-shadow-sm);
}

.tpsub-load-more:active {
    transform: translateY(-1px);
}

.tpsub-load-more:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.tpsub-load-more:disabled:hover {
    background: var(--tpsub-surface);
    color: var(--tpsub-primary);
    transform: none;
    box-shadow: var(--tpsub-shadow-xs);
}

/* Loading State for Load More Button */
.tpsub-load-more.loading {
    position: relative;
    color: transparent;
}

.tpsub-load-more.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid var(--tpsub-primary);
    border-radius: 50%;
    border-top-color: transparent;
    animation: tpsub-spin 0.8s linear infinite;
}

@keyframes tpsub-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tpsub-pagination {
        gap: 6px;
        margin: 30px 0 20px;
        flex-wrap: wrap;
    }

    .tpsub-pagination .page-numbers {
        min-width: 36px;
        height: 36px;
        padding: 6px 10px;
        font-size: 13px;
    }

    .tpsub-load-more-wrapper {
        margin: 20px 0 30px;
    }

    .tpsub-load-more {
        width: 100%;
        max-width: 300px;
        padding: 12px 24px;
        font-size: 14px;
    }
}
