/**
 * My Account Dashboard Styles
 *
 * Uses the existing GenX design system CSS custom properties.
 * Dark theme by default; light overrides via html[data-theme="light"].
 *
 * @package Avosec
 * @since 1.9.0
 */


/* ========================================
   Dashboard Container
   ======================================== */
.avosec-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-4, 16px) 0;
    font-family: var(--font-body, 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif);
}

/* ========================================
   Announcements Carousel
   ======================================== */
.dashboard-announcements {
    margin-bottom: var(--space-6, 24px);
}

.announcements-carousel {
    background: var(--portal-card, #1f2937);
    border: 1px solid var(--portal-border, #374151);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    position: relative;
}

/* ── Viewport & slides ── */
.carousel-viewport {
    position: relative;
    overflow: hidden;
}

/* ── Slide layout ── */
.carousel-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 600ms ease, visibility 600ms ease;
    z-index: 1;
}

.carousel-slide.is-active {
    position: relative;
    opacity: 1;
    visibility: visible;
    z-index: 2;
}

/* ── Hero image: full-height display ── */
.slide-hero {
    width: 100%;
    height: 340px;
    overflow: hidden;
    position: relative;
    background: var(--portal-border, #374151);
}

.slide-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform 600ms ease;
}

/* Subtle zoom on carousel hover */
.announcements-carousel:hover .carousel-slide.is-active .slide-hero img {
    transform: scale(1.03);
}

/* Bottom gradient for title readability */
.slide-hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to top,
        rgba(15, 23, 42, 0.85) 0%,
        rgba(15, 23, 42, 0.4) 50%,
        transparent 100%);
    pointer-events: none;
    z-index: 1;
}

/* ── Title overlay: pinned to bottom of hero image ── */
.announcement-title {
    position: absolute;
    bottom: 12px;
    left: var(--space-5, 20px);
    right: var(--space-5, 20px);
    z-index: 3;
    font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

/* ── Slide body: collapsible content below image ── */
.slide-body {
    position: relative;
    max-height: 0;
    overflow: hidden;
    padding: 0 var(--space-5, 20px);
    background: var(--portal-card, #1f2937);
    transition: max-height 400ms cubic-bezier(0.4, 0, 0.2, 1),
                padding 400ms ease;
}

/* "Read more" hint bar — always visible */
.slide-body::before {
    content: 'Hover to read more';
    display: none;
}

/* Clickable expand hint below image */
.carousel-slide.is-active .slide-hero + .slide-body + .announcement-dismiss ~ .slide-expand-hint,
.announcements-carousel .slide-expand-hint {
    display: block;
}

/* Expand content on carousel hover */
.announcements-carousel:hover .carousel-slide.is-active .slide-body {
    max-height: 220px;
    padding-top: var(--space-4, 16px);
    padding-bottom: var(--space-3, 12px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--portal-border, #374151) transparent;
}

.announcements-carousel:hover .carousel-slide.is-active .slide-body::-webkit-scrollbar {
    width: 4px;
}

.announcements-carousel:hover .carousel-slide.is-active .slide-body::-webkit-scrollbar-thumb {
    background: var(--portal-border, #374151);
    border-radius: 2px;
}

/* ── "Read more" indicator bar ── */
.announcements-carousel .carousel-slide.is-active ~ .carousel-nav::before {
    /* Managed by the nav border-top already */
}

/* ── Message content ── */
.announcement-message {
    font-size: 13px;
    color: var(--color-text-secondary, #94a3b8);
    line-height: 1.6;
}

.announcement-message p {
    margin: 0 0 var(--space-2, 8px) 0;
}

.announcement-message p:last-child {
    margin-bottom: 0;
}

.announcement-message ul,
.announcement-message ol {
    margin: var(--space-1, 4px) 0 var(--space-2, 8px) var(--space-5, 20px);
    padding: 0;
}

.announcement-message li {
    margin-bottom: var(--space-1, 4px);
}

.announcement-message strong {
    color: var(--color-text-primary, #f1f5f9);
}

.announcement-message em {
    font-size: 12px;
    opacity: 0.7;
}

/* ── Expand hint strip between image and nav ── */
.announcements-carousel .expand-hint {
    text-align: center;
    padding: 6px 0;
    font-size: 11px;
    color: var(--color-accent, #10b981);
    letter-spacing: 0.04em;
    opacity: 0.7;
    cursor: default;
    transition: opacity 300ms ease;
    border-top: 1px solid var(--portal-border, #374151);
}

.announcements-carousel:hover .expand-hint {
    opacity: 0;
    height: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

/* ────────────────────────────────────────────────────────────────
   Text-only announcements (no banner image)
   Render as a clean, fully-readable notice card instead of a fixed
   340px hero: no empty image box, title as a normal heading, and the
   message shown inline (no hover-to-expand). Image announcements are
   untouched — these rules are scoped to .carousel-slide.no-image.
   ──────────────────────────────────────────────────────────────── */
.carousel-slide.no-image .slide-hero {
    height: auto;
    background: transparent;
    padding: var(--space-4, 16px) var(--space-5, 20px) 0;
}

/* Drop the image-readability gradient and any stray image box */
.carousel-slide.no-image .slide-hero::after,
.carousel-slide.no-image .slide-hero img {
    display: none;
}

/* Title becomes an in-flow heading (theme-aware), not a white overlay */
.carousel-slide.no-image .announcement-title {
    position: static;
    inset: auto;
    padding-right: 28px; /* clear the dismiss button */
    font-size: 16px;
    color: var(--color-text-primary, #f1f5f9) !important;
    text-shadow: none !important;
}

/* Message is always visible — no collapse, no hover requirement */
.carousel-slide.no-image .slide-body {
    max-height: none !important;
    overflow: visible !important;
    padding: var(--space-2, 8px) var(--space-5, 20px) var(--space-4, 16px) !important;
}

/* ── Dismiss button ── */
.carousel-slide .announcement-dismiss,
.announcement-dismiss {
    position: absolute;
    top: var(--space-3, 12px);
    right: var(--space-3, 12px);
    z-index: 10;
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 50% !important;
    color: rgba(255, 255, 255, 0.7) !important;
    cursor: pointer;
    transition: all var(--transition-fast, 150ms) ease;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    line-height: 1;
    font-size: 14px;
    appearance: none;
    -webkit-appearance: none;
}

.carousel-slide .announcement-dismiss:hover,
.announcement-dismiss:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
    transform: scale(1.1);
}

/* ── Navigation dots + counter ── */
.carousel-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4, 16px);
    padding: var(--space-3, 12px) var(--space-5, 20px);
    border-top: 1px solid var(--portal-border, #374151);
}

.carousel-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.carousel-nav .carousel-dot,
.carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50% !important;
    border: none !important;
    background: var(--color-text-muted, #4b5563) !important;
    cursor: pointer;
    padding: 0;
    transition: all 300ms ease;
    position: relative;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
}

.carousel-dot::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
}

.carousel-nav .carousel-dot.is-active,
.carousel-dot.is-active {
    background: var(--color-accent, #10b981) !important;
    border: none !important;
    width: 24px;
    border-radius: 5px !important;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.carousel-nav .carousel-dot:hover:not(.is-active),
.carousel-dot:hover:not(.is-active) {
    background: #9ca3af !important;
}

.carousel-counter {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--color-text-muted, #64748b);
}

.carousel-counter .carousel-current {
    color: var(--color-text-primary, #f1f5f9);
    font-weight: 600;
}

/* ── Progress bar (auto-rotation indicator) ── */
.announcements-carousel::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--color-accent, #10b981);
    z-index: 10;
    width: 0;
    transition: none;
}

.announcements-carousel.is-playing::before {
    animation: carouselProgress var(--carousel-interval, 8s) linear;
}

@keyframes carouselProgress {
    from { width: 0; }
    to   { width: 100%; }
}

/* ── Paused state on hover ── */
.announcements-carousel:hover::before {
    animation-play-state: paused;
}

/* ========================================
   Stat Cards Grid
   ======================================== */
.dashboard-stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4, 16px);
    margin-bottom: var(--space-6, 24px);
}

.dashboard-stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-4, 16px);
    padding: var(--space-5, 20px);
    background: var(--portal-card, #1f2937);
    border: 1px solid var(--portal-border, #374151);
    border-radius: var(--radius-lg, 12px);
    text-decoration: none;
    color: var(--color-text-primary, #f1f5f9);
    transition: all var(--transition-base, 200ms) ease;
}

.dashboard-stat-card:hover {
    background: var(--portal-card-hover, #263244);
    border-color: var(--color-accent, #10b981);
    transform: translateY(-2px);
    text-decoration: none;
    color: var(--color-text-primary, #f1f5f9) !important;
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

.dashboard-stat-card:hover .stat-card-value,
.dashboard-stat-card:hover .stat-card-label {
    color: inherit !important;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md, 8px);
    flex-shrink: 0;
}

.stat-card-icon .dashicons {
    font-size: 22px;
    width: 22px;
    height: 22px;
    line-height: 1;
}

.stat-card-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-card-value {
    font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--color-text-primary, #f1f5f9);
    transition: opacity var(--transition-fast, 150ms) ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.stat-card-value.updating {
    opacity: 0.4;
}

.stat-card-label {
    font-size: 13px;
    color: var(--color-text-muted, #64748b);
    margin-top: var(--space-1, 4px);
    white-space: normal;
    line-height: 1.3;
}

/* Link card variant (e.g., "Go to Portal") */
.stat-card-link .stat-card-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-accent, #10b981);
}

.stat-card-arrow {
    margin-left: auto;
    color: var(--color-text-muted, #64748b);
    transition: transform var(--transition-fast, 150ms) ease;
}

.dashboard-stat-card:hover .stat-card-arrow {
    transform: translateX(4px);
    color: var(--color-accent, #10b981);
}

/* ========================================
   Quick Actions Bar
   ======================================== */
.dashboard-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3, 12px);
    margin-bottom: var(--space-6, 24px);
}

.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2, 8px);
    padding: var(--space-2, 8px) var(--space-4, 16px);
    background: var(--portal-card, #1f2937);
    border: 1px solid var(--portal-border, #374151);
    border-radius: var(--radius-md, 8px);
    color: var(--color-text-primary, #f1f5f9);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast, 150ms) ease;
    white-space: nowrap;
}

.quick-action-btn:hover {
    background: var(--color-accent, #10b981);
    border-color: var(--color-accent, #10b981);
    color: #fff !important;
    text-decoration: none;
    transform: translateY(-1px);
}

.quick-action-btn .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    line-height: 1;
}

.quick-action-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.quick-action-subtitle {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.7;
}

/* ========================================
   License Expiration Preview Tables
   ======================================== */
.dashboard-license-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: var(--space-4, 16px);
    margin-bottom: var(--space-6, 24px);
}

/* When odd number of cards, last one spans full width */
.dashboard-license-preview > .license-preview-section:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.license-preview-section .dashboard-section-header {
    border-radius: var(--radius-lg, 12px) var(--radius-lg, 12px) 0 0;
}

.license-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.license-preview-table thead th {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--color-text-muted, #64748b);
    padding: 0 var(--space-2, 8px) var(--space-2, 8px);
    border-bottom: 1px solid var(--portal-border, #374151);
    text-align: left;
    white-space: nowrap;
}

.license-preview-table tbody td {
    padding: var(--space-2, 8px);
    color: var(--color-text-secondary, #94a3b8);
    border-bottom: 1px solid var(--portal-border-subtle, #1f2937);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.license-preview-table tbody tr:last-child td {
    border-bottom: none;
}

.license-preview-table tbody tr:hover td {
    background: var(--portal-card-hover, #263244);
}

.license-key-cell {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 12px;
    max-width: 120px;
}

.license-preview-footer {
    padding: var(--space-3, 12px) var(--space-5, 20px);
    border-top: 1px solid var(--portal-border, #374151);
    text-align: right;
}

/* Expiry color coding */
.expiry-cell {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.expiry-expired {
    color: #ef4444;
}

.expiry-expiring_30 {
    color: #f97316;
}

.expiry-expiring_60 {
    color: #eab308;
}

.view-all-btn {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-accent, #10b981);
    text-decoration: none;
    transition: color var(--transition-fast, 150ms) ease;
}

.view-all-btn:hover {
    color: var(--color-accent-hover, #059669);
    text-decoration: none;
}

/* ========================================
   Bottom Grid (Pipeline + Activity)
   ======================================== */
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: var(--space-4, 16px);
}

/* ========================================
   Dashboard Sections (shared)
   ======================================== */
.dashboard-section {
    background: var(--portal-card, #1f2937);
    border: 1px solid var(--portal-border, #374151);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
}

.dashboard-section-header {
    padding: var(--space-4, 16px) var(--space-5, 20px);
    border-bottom: 1px solid var(--portal-border, #374151);
}

.dashboard-section-header h2 {
    font-family: var(--font-heading, 'Plus Jakarta Sans', sans-serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-primary, #f1f5f9);
    margin: 0;
    letter-spacing: -0.01em;
}

.dashboard-section-body {
    padding: var(--space-4, 16px) var(--space-5, 20px);
}

.dashboard-empty {
    text-align: center;
    color: var(--color-text-muted, #64748b);
    font-size: 14px;
    padding: var(--space-6, 24px) 0;
    margin: 0;
}

/* ========================================
   Pipeline Visualization
   ======================================== */
.pipeline-stages {
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 12px);
}

.pipeline-stage {
    display: grid;
    grid-template-columns: 140px 1fr 36px;
    align-items: center;
    gap: var(--space-3, 12px);
}

.pipeline-label {
    font-size: 13px;
    color: var(--color-text-secondary, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pipeline-bar-track {
    height: 10px;
    background: var(--portal-border, #374151);
    border-radius: 5px;
    overflow: hidden;
}

.pipeline-bar-fill {
    height: 100%;
    border-radius: 5px;
    min-width: 4px;
    transition: width var(--transition-slow, 300ms) ease;
}

.pipeline-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary, #f1f5f9);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ========================================
   Activity Feed
   ======================================== */
.dashboard-activity .activity-feed {
    padding: 0;
}

.dashboard-activity .activity-item {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-3, 12px) 0;
    border-bottom: 1px solid var(--portal-border-subtle, #1f2937);
}

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

.dashboard-activity .activity-avatar {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent, #10b981);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.dashboard-activity .activity-content {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
    min-width: 0;
}

.dashboard-activity .activity-action {
    color: var(--color-text-secondary, #94a3b8);
}

.dashboard-activity .activity-ref {
    color: var(--color-accent, #10b981);
    font-weight: 500;
    margin-left: var(--space-1, 4px);
}

.dashboard-activity .activity-time {
    color: var(--color-text-muted, #64748b);
    font-size: 12px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* ========================================
   Welcome Bar (replaces WooCommerce greeting)
   ======================================== */
.avosec-welcome-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3, 12px) var(--space-5, 20px);
    margin-top: calc(-1 * var(--space-2, 8px));
    margin-bottom: var(--space-4, 16px);
    background: var(--color-bg-elevated, #1e293b);
    border: 1px solid var(--color-border, #334155);
    border-radius: var(--radius-lg, 12px);
}

.welcome-greeting {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text-primary, #f1f5f9);
}

.welcome-last-login {
    font-size: 0.85rem;
    color: var(--color-text-muted, #64748b);
}

@media (max-width: 600px) {
    .avosec-welcome-bar {
        flex-direction: column;
        gap: var(--space-2, 8px);
        text-align: center;
    }
}

/* ========================================
   Light Theme Overrides
   ======================================== */
/* Welcome bar light theme: handled by design system token redefinition */

html[data-theme="light"] .announcements-carousel {
    background: #ffffff;
    border-color: #e5e7eb;
}

/* Force white title on hero images regardless of theme — dark images need white text always */
.slide-hero .announcement-title {
    color: #ffffff !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6) !important;
}

html[data-theme="light"] .slide-body {
    background: #ffffff;
}

html[data-theme="light"] .announcement-message {
    color: var(--color-text-secondary);
}

html[data-theme="light"] .announcement-message strong {
    color: var(--color-text-primary);
}

html[data-theme="light"] .expand-hint {
    border-top-color: #e5e7eb;
}

html[data-theme="light"] .announcement-dismiss {
    background: rgba(255, 255, 255, 0.7) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: #6b7280 !important;
}

html[data-theme="light"] .announcement-dismiss:hover {
    background: rgba(0, 0, 0, 0.4) !important;
    color: #fff !important;
}

html[data-theme="light"] .carousel-nav {
    border-top-color: #e5e7eb;
}

html[data-theme="light"] .carousel-dot {
    background: #e5e7eb;
}

html[data-theme="light"] .carousel-dot:hover:not(.is-active) {
    background: #9ca3af;
}

html[data-theme="light"] .slide-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
}

html[data-theme="light"] .dashboard-stat-card {
    background: #ffffff;
    border-color: #e5e7eb;
    color: var(--color-text-primary);
}

html[data-theme="light"] .dashboard-stat-card:hover {
    background: #f9fafb;
}

html[data-theme="light"] .stat-card-value {
    color: var(--color-text-primary);
}

html[data-theme="light"] .stat-card-label {
    color: #9ca3af;
}

html[data-theme="light"] .quick-action-btn {
    background: #ffffff;
    border-color: #e5e7eb;
    color: var(--color-text-primary);
}

html[data-theme="light"] .quick-action-btn:hover {
    background: var(--color-accent, #10b981);
    border-color: var(--color-accent, #10b981);
    color: #fff !important;
}

html[data-theme="light"] .dashboard-section {
    background: #ffffff;
    border-color: #e5e7eb;
}

html[data-theme="light"] .dashboard-section-header {
    border-bottom-color: #e5e7eb;
}

html[data-theme="light"] .dashboard-section-header h2 {
    color: var(--color-text-primary);
}

html[data-theme="light"] .pipeline-label {
    color: var(--color-text-secondary);
}

html[data-theme="light"] .pipeline-bar-track {
    background: #e5e7eb;
}

html[data-theme="light"] .pipeline-count {
    color: var(--color-text-primary);
}

html[data-theme="light"] .dashboard-activity .activity-item {
    border-bottom-color: #f3f4f6;
}

html[data-theme="light"] .dashboard-activity .activity-action {
    color: var(--color-text-secondary);
}

html[data-theme="light"] .dashboard-activity .activity-time {
    color: #9ca3af;
}

html[data-theme="light"] .dashboard-empty {
    color: #9ca3af;
}

html[data-theme="light"] .license-preview-table thead th {
    color: #9ca3af;
    border-bottom-color: #e5e7eb;
}

html[data-theme="light"] .license-preview-table tbody td {
    color: var(--color-text-secondary);
    border-bottom-color: #f3f4f6;
}

html[data-theme="light"] .license-preview-table tbody tr:hover td {
    background: #f9fafb;
}

html[data-theme="light"] .license-preview-footer {
    border-top-color: #e5e7eb;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .dashboard-bottom-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-license-preview {
        grid-template-columns: 1fr;
    }

    .slide-hero {
        height: 200px;
    }

    /* On mobile/touch, always show content (no hover) */
    .slide-body {
        max-height: 180px !important;
        padding: var(--space-3, 12px) var(--space-5, 20px) !important;
        overflow-y: auto;
    }

    .expand-hint {
        display: none !important;
    }

    .pipeline-stage {
        grid-template-columns: 100px 1fr 30px;
    }

    .dashboard-quick-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .dashboard-quick-actions::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 480px) {
    .dashboard-stat-cards {
        grid-template-columns: 1fr;
    }

    .stat-card-value {
        font-size: 22px;
    }

    .dashboard-section-body {
        padding: var(--space-3, 12px);
    }

    .pipeline-stage {
        grid-template-columns: 80px 1fr 28px;
    }

    .pipeline-label {
        font-size: 12px;
    }
}

/* ========================================
   AJAX Refresh Transitions
   ======================================== */
.dashboard-stat-card.refreshing .stat-card-value {
    opacity: 0.3;
    transition: opacity var(--transition-fast, 150ms) ease;
}

.dashboard-pipeline.refreshing .pipeline-bar-fill {
    opacity: 0.5;
}

.dashboard-activity.refreshing .activity-feed {
    opacity: 0.5;
}

@keyframes dashboardFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.activity-item-new {
    animation: dashboardFadeIn var(--transition-base, 200ms) ease;
}

/* =========================================================================
   Vendor Promo Drawer — Industrial Utilitarian
   Frosted-glass tab, accent-lined panel, depth-aware cards
   ========================================================================= */

.avosec-promo-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

/* Shrink cookie consent widget for a cleaner bottom-left */
.cky-btn-revisit-wrapper.cky-revisit-bottom-left {
    width: 36px !important;
    height: 36px !important;
}

.cky-btn-revisit-wrapper .cky-btn-revisit img {
    width: 36px !important;
    height: 36px !important;
}

/* ── Tab ── frosted glass with accent glow */
.promo-drawer-tab {
    position: absolute;
    right: 0;
    top: 28%;
    transform: translateY(-50%);
    width: 40px;
    height: 48px;
    background: linear-gradient(145deg, rgba(59, 130, 246, 0.92), rgba(37, 99, 235, 0.96));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-right: none;
    border-radius: 10px 0 0 10px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    box-shadow:
        -3px 2px 18px rgba(59, 130, 246, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: width 200ms ease, box-shadow 200ms ease,
                right 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.promo-drawer-tab:hover {
    width: 44px;
    box-shadow:
        -4px 2px 28px rgba(59, 130, 246, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.promo-drawer-tab:active {
    width: 40px;
    box-shadow:
        -2px 1px 12px rgba(59, 130, 246, 0.3),
        inset 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* ── Badge ── ambient pulse draws attention without aggression */
.promo-drawer-badge {
    position: absolute;
    top: -6px;
    left: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: promoBadgePulse 3s ease-in-out infinite;
}

@keyframes promoBadgePulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35); }
    50%      { box-shadow: 0 2px 14px rgba(239, 68, 68, 0.65); }
}

/* ── Panel ── accent gradient top-line, deep shadow */
.promo-drawer-panel {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 340px;
    background: var(--portal-card, #1f2937);
    border-left: 1px solid var(--portal-border, #374151);
    box-shadow: -8px 0 36px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    display: none;
    flex-direction: column;
    pointer-events: auto;
}

/* Accent gradient top-line — signals brand without being loud */
.promo-drawer-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        var(--portal-accent, #3b82f6) 0%,
        rgba(59, 130, 246, 0.3) 60%,
        transparent 100%);
    z-index: 1;
}

/* is-open only controls display — transform is handled by JS inline
   styles so we can force a reflow between display and transform changes,
   which is required for CSS transitions to work with display:none elements */
.avosec-promo-drawer.is-open .promo-drawer-panel {
    display: flex;
}

.avosec-promo-drawer.is-open .promo-drawer-tab {
    right: 340px;
}

/* ── Header ── */
.promo-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--portal-border, #374151);
    flex-shrink: 0;
}

.promo-drawer-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--portal-text, #f9fafb);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.promo-drawer-close {
    background: none;
    border: none;
    color: var(--portal-text-muted, #9ca3af);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 150ms ease, background 150ms ease;
}

.promo-drawer-close:hover {
    color: var(--portal-text, #f9fafb);
    background: rgba(255, 255, 255, 0.08);
}

/* ── Body ── scrollable card list */
.promo-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ── Cards ── depth on hover, refined spacing */
.promo-card {
    background: var(--portal-bg, #111827);
    border: 1px solid var(--portal-border, #374151);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    transition: opacity 300ms ease, transform 300ms ease,
                box-shadow 200ms ease, border-color 200ms ease;
}

.promo-card:hover {
    border-color: rgba(59, 130, 246, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.promo-card.is-dismissing {
    opacity: 0;
    transform: translateX(100%);
}

.promo-card-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: var(--portal-bg, #111827);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Gradient fade at image bottom — blends into card content */
.promo-card-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    background: linear-gradient(to top, var(--portal-bg, #111827), transparent);
    pointer-events: none;
}

.promo-card-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.promo-card-content {
    padding: 14px 16px;
}

.promo-card-title {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--portal-text, #f9fafb);
    line-height: 1.35;
}

.promo-card-message {
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--portal-text-muted, #9ca3af);
    margin: 0 0 12px;
}

.promo-card-message p {
    margin: 0 0 4px;
}

/* ── CTA button ── glow on hover */
a.promo-card-cta,
a.promo-card-cta:link,
a.promo-card-cta:visited,
a.promo-card-cta:active {
    display: inline-block;
    padding: 7px 18px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 6px;
    background: var(--portal-accent, #3b82f6) !important;
    color: #fff !important;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: background 200ms ease, box-shadow 200ms ease;
}

a.promo-card-cta:hover {
    background: var(--portal-accent-hover, #2563eb) !important;
    color: #fff !important;
    box-shadow: 0 2px 14px rgba(59, 130, 246, 0.35);
}

/* ── Dismiss button ── frosted glass, turns red on hover */
button.promo-card-dismiss {
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    z-index: 5;
    background: rgba(17, 24, 39, 0.7) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: none !important;
    border-left: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
    border-radius: 0 0 0 8px !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.45) !important;
    cursor: pointer;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1 !important;
    font-size: 12px !important;
    transition: background 150ms ease, color 150ms ease;
    box-shadow: none !important;
    outline: none !important;
}

button.promo-card-dismiss:hover {
    background: rgba(239, 68, 68, 0.85) !important;
    color: #fff !important;
}

/* ── Backdrop ── subtle blur for depth */
.promo-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 300ms ease, visibility 300ms ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.promo-drawer-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ═════════════════════════════════════════════════════════════
   Light theme overrides
   ═════════════════════════════════════════════════════════════ */

html[data-theme="light"] .promo-drawer-panel {
    background: #ffffff;
    border-left-color: var(--portal-border, #e5e7eb);
    box-shadow: -8px 0 36px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .promo-drawer-panel::before {
    background: linear-gradient(90deg,
        var(--portal-accent, #3b82f6) 0%,
        rgba(59, 130, 246, 0.15) 60%,
        transparent 100%);
}

html[data-theme="light"] .promo-card {
    background: #f8fafc;
    border-color: var(--portal-border, #e5e7eb);
}

html[data-theme="light"] .promo-card:hover {
    border-color: rgba(59, 130, 246, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .promo-card-image::after {
    background: linear-gradient(to top, #f8fafc, transparent);
}

html[data-theme="light"] .promo-drawer-title {
    color: #0f172a;
}

html[data-theme="light"] .promo-drawer-close {
    color: #6b7280;
}

html[data-theme="light"] .promo-drawer-close:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1f2937;
}

html[data-theme="light"] .promo-card-title {
    color: #0f172a;
}

html[data-theme="light"] .promo-card-message {
    color: #4b5563;
}

html[data-theme="light"] button.promo-card-dismiss {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: #9ca3af !important;
    border-left-color: var(--portal-border, #e5e7eb) !important;
    border-bottom-color: var(--portal-border, #e5e7eb) !important;
}

html[data-theme="light"] button.promo-card-dismiss:hover {
    background: rgba(239, 68, 68, 0.9) !important;
    color: #fff !important;
}

html[data-theme="light"] .promo-drawer-backdrop {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
}

/* ── Responsive ── */
@media (max-width: 600px) {
    .promo-drawer-panel {
        width: 100vw;
    }
    .avosec-promo-drawer.is-open .promo-drawer-tab {
        display: none;
    }
}
