@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

/**
 * App-specific styles for CoreInsights Reports
 */

/* Header (legacy shell; main app uses admin.css top bar). Exclude .landing-header — PolicyCompare login has no global header shadow. */
header:not(.landing-header) {
    background: #EEF2F7;
    padding: 24px 28px;
    box-shadow: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Exclude shell toolbar title — it uses .shell-page-title tokens (16px bold) in admin.css */
header:not(.landing-header) h1:not(.shell-page-title) {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Main app container — shell height from admin.css */
#app {
    min-height: 100vh;
    font-family: var(--font-main);
    font-size: var(--font-size-body);
}

.header-logo {
    height: 80px;
    width: auto;
}

/* Profile Menu */
.profile-menu {
    position: relative;
}

.profile-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-full);
    background: var(--primary-color);
    color: var(--btn-primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-body);
    font-weight: 600;
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-primary);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1000;
}

.profile-dropdown.show {
    display: block;
}

.profile-info {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.profile-email {
    font-size: var(--font-size-body);
    color: var(--text-secondary);
    display: block;
}

.logout-btn {
    width: 100%;
    padding: 0.75rem var(--spacing-md);
    background: none;
    border: none;
    text-align: left;
    font-size: var(--font-size-body);
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: var(--bg-hover);
}

/* Dashboard styles */
.dashboard {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Admin: Manage Reports — workspace filter + grouped sections */
.ar-reports-toolbar {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md, 0.75rem);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg, 1.25rem);
}

.ar-reports-toolbar-label {
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    color: var(--text-secondary, inherit);
    padding-top: 0.5rem;
}

.ar-reports-filter-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm, 0.5rem);
    flex: 1;
    min-width: min(100%, 260px);
    max-width: 420px;
}

.ar-reports-filter-hint {
    font-size: var(--font-size-body, 14px);
    color: var(--text-muted, inherit);
    margin: 0;
    line-height: 1.4;
}

/* Manage Reports: workspace checkbox dropdown */
.ar-ws-multiselect {
    position: relative;
    width: 100%;
}

.ar-ws-multiselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md, 0.75rem);
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: var(--font-size-sm, 0.875rem);
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #ccc);
    border-radius: var(--radius-md, 6px);
    color: var(--text-primary, inherit);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ar-ws-multiselect-trigger:hover {
    border-color: var(--primary-color, #0067b8);
}

.ar-ws-multiselect.is-open .ar-ws-multiselect-trigger {
    border-color: var(--primary-color, #0067b8);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary-color, #0067b8) 25%, transparent);
}

.ar-ws-multiselect-trigger-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ar-ws-multiselect-chevron {
    flex-shrink: 0;
    font-size: 0.65rem;
    opacity: 0.75;
    transition: transform 0.15s ease;
}

.ar-ws-multiselect.is-open .ar-ws-multiselect-chevron {
    transform: rotate(180deg);
}

.ar-ws-multiselect-panel {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    max-height: min(320px, 70vh);
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #ccc);
    border-radius: var(--radius-md, 6px);
    box-shadow: var(--shadow-md, 0 4px 16px rgba(0, 0, 0, 0.12));
    overflow: hidden;
}

.ar-ws-multiselect-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    max-height: 240px;
}

.ar-ws-multiselect-panel[hidden] {
    display: none !important;
}

.ar-ws-multiselect-option {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm, 0.5rem);
    padding: 0.45rem 0.75rem;
    font-size: var(--font-size-sm, 0.875rem);
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.06));
}

.ar-ws-multiselect-list .ar-ws-multiselect-option:last-child {
    border-bottom: none;
}

.ar-ws-multiselect-option:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.ar-ws-multiselect-option input {
    margin-top: 0.2rem;
    flex-shrink: 0;
    cursor: pointer;
}

.ar-ws-multiselect-option-label {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
    word-break: break-word;
}

.ar-ws-multiselect-footer {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm, 0.5rem);
    padding: var(--spacing-sm, 0.5rem) 0.75rem;
    border-top: 1px solid var(--border-color, #ccc);
    background: var(--bg-secondary, rgba(0, 0, 0, 0.02));
}

.ar-ws-multiselect-footer-btn {
    font-size: var(--font-size-xs, 0.75rem);
    padding: 0.35rem 0.65rem;
}

.ar-workspace-sections {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl, 1.5rem);
}

.ar-workspace-section {
    margin: 0;
}

.ar-workspace-heading {
    font-size: var(--font-size-md, 1rem);
    font-weight: 600;
    margin: 0 0 var(--spacing-md, 0.75rem);
    padding-bottom: var(--spacing-sm, 0.5rem);
    border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.12));
    color: var(--text-primary, inherit);
}

.module-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.module-card:hover:not(.disabled) {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.module-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
}

.module-card h3 {
    font-size: var(--font-size-page-title);
    font-weight: 600;
    font-family: var(--font-main);
    color: var(--color-text-main);
}

/* View container styles */
.view-container {
    padding: 0.25rem;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 85px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
}

.view-header h2 {
    font-size: var(--font-size-page-title);
    font-weight: 600;
    font-family: var(--font-main);
    margin: 0;
}

.back-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    cursor: pointer;
    padding: 0.25rem 0;
}

.back-btn:hover {
    text-decoration: underline;
}

/* Placeholder view */
.placeholder-view {
    padding: 2rem;
    max-width: 800px;
    margin: 2rem auto;
    text-align: center;
}

.placeholder-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-card);
    padding: 3rem 2rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
}

.placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.placeholder-card h2 {
    font-size: var(--font-size-page-title);
    font-weight: 600;
    font-family: var(--font-main);
    color: var(--color-text-main);
    margin-bottom: 0.5rem;
}

.placeholder-card p {
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    color: var(--color-text-muted);
    margin-bottom: 0;
}

/* Toast notification */
toast-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    background: var(--bg-primary);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
}

/* Report viewer / tool modals (share, bookmarks, analytics) */
.pbi-modal-card {
    max-width: 520px;
    text-align: left;
    background: var(--color-bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-dropdown);
}

.pbi-modal-card--narrow {
    max-width: 480px;
}

.pbi-modal-card--bookmarks {
    max-width: 420px;
}

.pbi-modal-title {
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

.pbi-modal-title--tight {
    margin-bottom: var(--spacing-sm);
}

.pbi-modal-footer {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

.pbi-modal-body-text {
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-body);
    color: var(--text-secondary);
}

/* ============================================
   Login landing — same rules as PolicyCompare:
   policyCompare/src/app/components/login/login.component.css
   + :root landing tokens from policyCompare/src/styles.css (scoped on .landing-layout)
   ============================================ */

/* Landing is the only flow that should scroll at the document level (not clipped by global html/body/#app).
   Scope to login shell — .login-page can remain in a hidden #page-login on other routes, so use .app-shell--login. */
html:has(#app-shell.app-shell--login),
body:has(#app-shell.app-shell--login) {
    overflow: auto !important;
    height: auto !important;
}

body:has(#app-shell.app-shell--login) #app,
body:has(#app-shell.app-shell--login) #app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
}

body:has(#app-shell.app-shell--login) #app-shell.app-shell--login #main-content {
    overflow: visible !important;
    height: auto;
    min-height: min-content;
}

body:has(#app-shell.app-shell--login) #app-shell.app-shell--login #page-login.page {
    flex: 1 1 auto;
    min-height: min-content;
    height: auto;
    overflow: visible;
}

body:has(#app-shell.app-shell--login) #app-shell.app-shell--login #page-login .landing-layout {
    flex: 1 1 auto;
    min-height: min-content;
    height: auto;
    overflow: visible;
}

.login-page,
.landing-layout {
    min-height: 100vh;
    height: auto;
    overflow: visible;
}

.landing-layout {
    /* Login landing — tokens align with global design system */
    --font-heading: var(--font-main);
    --font-body: var(--font-main);
    --brand-navy: var(--color-navy);
    --bg: var(--color-bg-page);
    --surface: var(--color-bg-card);
    --text: var(--color-text-main);
    --muted: var(--color-text-muted);
    --border: var(--color-border);
    --accent: var(--color-primary);
    --accent-hover: var(--color-navy);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 30px;
    --shadow: var(--shadow-dropdown);
    --shadow-card: var(--shadow);
    --danger: var(--color-danger);
    --danger-bg: var(--color-danger-bg);
    --danger-border-soft: var(--color-danger-border);

    --color-primary-hover: var(--primary-hover);
    --color-primary-shadow: color-mix(in srgb, var(--color-primary) 35%, transparent);
    --radius-full: var(--radius-pill);

    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    font-family: var(--font-body);
    color: var(--text);
    line-height: 1.6;
}

.landing-header {
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.landing-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.landing-logo .logo-img {
    height: auto;
    max-height: 48px;
    width: auto;
    display: block;
}

.logo-img {
    height: 90px;
    width: auto;
    display: block;
}

main.landing-content,
.landing-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 0;
}

.landing-hero {
    text-align: center;
    max-width: 1000px;
    width: 100%;
    padding: 0 24px;
    box-sizing: border-box;
}

.landing-hero h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.landing-hero h1 span {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--brand-navy));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.landing-tagline {
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    color: var(--muted);
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

.auth-alert {
    margin: 0 auto 1.5rem;
    max-width: 500px;
    padding: 12px 14px;
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    line-height: 1.45;
    color: var(--danger);
    background: var(--danger-bg);
    border: 1px solid var(--danger-border-soft);
    border-radius: var(--radius-md);
}

.landing-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.landing-layout .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.875rem 1.75rem;
    font-family: var(--font-main);
    font-size: var(--font-size-body);
    font-weight: 400;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.landing-layout .btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 14px var(--color-primary-shadow);
}

.landing-layout .btn-primary:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 14px var(--color-primary-shadow);
}

.ms-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    display: block;
}

.landing-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 4rem;
    text-align: left;
    max-width: 1000px;
    width: 100%;
}

.landing-feature {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border);
}

.landing-feature-icon {
    width: 48px;
    height: 48px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: var(--accent);
}

.landing-feature h3 {
    font-family: var(--font-heading);
    font-size: var(--font-size-page-title);
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.landing-feature p {
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    color: var(--muted);
    line-height: 1.6;
    margin: 0;
}

footer.landing-footer,
.landing-footer {
    position: relative;
    width: 100%;
    margin-top: auto;
    padding: 2rem;
    text-align: center;
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.landing-footer a {
    color: var(--accent);
    text-decoration: none;
}

.landing-footer a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

@media (max-width: 900px) {
    .landing-hero .landing-features,
    .landing-features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
    }

    .landing-hero .landing-feature,
    .landing-feature {
        min-width: 0;
    }
}

@media (max-width: 768px) {
    .landing-header {
        padding: 1rem 1.5rem;
    }

    .landing-hero h1 {
        font-size: 2rem;
    }

    .landing-tagline {
        font-size: var(--font-size-body);
    }

    main.landing-content,
    .landing-content {
        padding: 2.5rem 1.25rem;
    }
}

@media (max-width: 600px) {
    .landing-hero .landing-features,
    .landing-features {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* ============================================
   Responsive adjustments
   ============================================ */

@media (max-width: 576px) {
    .dashboard {
        padding: 1rem;
    }
    
    .module-grid {
        grid-template-columns: 1fr;
    }
    
    .view-container {
        padding: 0.15rem;
        height: auto;
        overflow: visible;
    }
    
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .header-logo {
        height: 60px;
    }
    
    /* Toast notifications - center on mobile */
    toast-notification {
        left: 50%;
        right: auto;
        top: 10px;
        transform: translateX(-50%);
        max-width: calc(100% - 20px);
    }
}

@media (min-width: 577px) and (max-width: 992px) {
    .view-container {
        padding: 0.2rem;
        height: auto;
        overflow: visible;
    }
}

/* ============================================
   Add Report Button
   ============================================ */

.btn-add-report {
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    border: none;
    border-radius: var(--radius-btn);
    padding: 0.5rem 1rem;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    font-family: var(--font-main);
    transition: opacity var(--transition-fast) ease, box-shadow var(--transition-fast) ease;
}

.btn-add-report:hover {
    opacity: 0.92;
    box-shadow: var(--shadow-card);
}

/* ============================================
   Report Card & Remove Button
   ============================================ */

.report-card {
    position: relative;
}

.report-remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border: 1px solid var(--color-danger-border);
    border-radius: var(--radius-btn);
    width: 28px;
    height: 28px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-fast) ease;
}

.report-remove-btn:hover {
    background: var(--color-bg-page);
}

.report-workspace {
    display: block;
    font-size: var(--font-size-body);
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    background: var(--color-bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: var(--font-size-page-title);
    font-weight: 600;
    color: var(--color-text-main);
    margin: 0 0 0.5rem 0;
    font-family: var(--font-main);
}

.empty-state p {
    font-size: var(--font-size-body);
    color: var(--color-text-muted);
    margin: 0 0 1rem 0;
    font-family: var(--font-main);
}

/* ============================================
   Add Report Wizard
   ============================================ */

.wizard-steps-indicator {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.wizard-step {
    padding: 0.4rem 0.8rem;
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    font-weight: 500;
    color: var(--color-text-muted);
    background: var(--color-bg-page);
    border-radius: var(--radius-btn);
    transition: color 0.2s, background 0.2s;
}

.wizard-step.active {
    color: var(--color-text-on-primary);
    background: var(--color-primary);
}

.wizard-step.completed {
    color: var(--color-text-muted);
}

.wizard-container {
    flex: 1;
    overflow: auto;
}

/* Add Report — redesigned layout */
#main-content:has(#page-add-report:not(.hidden)) .shell-page-title {
    font-size: 14px;
    font-weight: 400;
    color: #7A8599;
}

.add-report-view {
    max-width: 100%;
    padding-bottom: var(--spacing-xl);
}

.add-report-view .page-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 16px;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.add-report-view .page-header .page-title {
    font-size: 32px;
    font-weight: 700;
    color: #22295C;
    margin: 0;
    font-family: var(--font-main);
    line-height: 1.2;
}

.add-report-view .page-header .page-subtitle {
    font-size: 14px;
    color: #7A8599;
    margin: 4px 0 0;
    font-family: var(--font-main);
    font-weight: 400;
    line-height: 1.4;
}

/* Workspace tabs — browser tab row on top of card */
.add-report-view .workspace-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 4px;
    margin-bottom: 0;
    padding: 0;
    border-bottom: none;
    background: transparent;
}

.add-report-view .workspace-tabs.is-loading {
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    min-height: 0;
    padding: 28px 0 36px;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    overflow: visible;
}

.add-report-view .workspace-tabs.is-loading + .add-report-card {
    border-radius: 12px;
}

.add-report-view .add-report-tabs-loading {
    display: flex;
    justify-content: center;
    width: 100%;
    position: relative;
    z-index: 2;
}

.add-report-view .workspace-tabs.is-loading .ci-loader {
    padding: 0;
    min-height: 0;
}

.workspace-tabs .add-report-tabs-loading,
.workspace-tabs .add-report-tabs-empty {
    margin: 0 0 12px;
}

.add-report-view .workspace-tab {
    padding: 8px 18px;
    font-family: var(--font-main);
    font-size: 14px;
    font-weight: 500;
    color: #7A8599;
    background: #EEF2F7;
    border: 1px solid #E0E8F0;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    position: relative;
    bottom: -1px;
    margin: 0;
    line-height: 1.2;
}

.add-report-view .workspace-tab:hover {
    color: #22295C;
}

.add-report-view .workspace-tab.active {
    background: #FFFFFF;
    color: #22295C;
    font-weight: 600;
    border-color: #E0E8F0;
    border-bottom: 1px solid #FFFFFF;
    z-index: 1;
}

.add-report-card {
    background: #FFFFFF;
    border: 1px solid #E0E8F0;
    border-radius: 0 12px 12px 12px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: row;
    min-height: 500px;
    box-sizing: border-box;
    max-width: 100%;
    position: relative;
    z-index: 0;
}

.add-report-left,
.add-report-right {
    flex: 1;
    min-width: 0;
    padding: 28px;
    box-sizing: border-box;
}

.add-report-left {
    border-right: 1px solid #E0E8F0;
}

.add-report-left.is-locked {
    opacity: 0.55;
}

.add-report-right.disabled {
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}

.add-report-pages-block {
    margin-top: 28px;
}

.add-report-details-block {
    margin-bottom: 28px;
}

.add-report-scroll {
    max-height: none;
    overflow: visible;
    padding-right: 0;
}

.add-report-section {
    margin-bottom: var(--spacing-xl);
}

.add-report-section-title {
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-main);
    margin: 0 0 var(--spacing-md);
    color: #22295C;
}

.add-report-select-full {
    max-width: none;
    width: 100%;
    display: block;
    margin-bottom: var(--spacing-md);
}

.add-report-hint {
    font-size: 14px;
    font-family: var(--font-main);
    color: #7A8599;
    margin: 0 0 var(--spacing-md);
    line-height: 1.45;
}

.add-report-rls-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    margin-top: var(--spacing-md);
    cursor: pointer;
    color: #22295C;
}

.add-report-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
    margin-top: 28px;
    padding-bottom: var(--spacing-xl);
}

.add-report-cancel {
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 400;
    color: #7A8599;
    text-decoration: none;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
}

.add-report-cancel:hover {
    color: #22295C;
    text-decoration: underline;
}

.add-report-view .add-report-save-btn {
    background: #65BDC6;
    color: #FFFFFF;
    height: 56px;
    min-width: 160px;
    padding: 0 32px;
    border-radius: 12px;
    border: none;
    font-family: var(--font-main);
    font-size: 16px;
    font-weight: 500;
}

.add-report-view .add-report-save-btn:hover {
    opacity: 0.92;
}

.add-report-view .add-report-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Assign access — add row */
.add-report-view .add-report-perm-addrow {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    margin-bottom: 0;
    align-items: center;
}

.add-report-view .add-report-perm-addrow .add-report-perm-select {
    flex: 1;
    min-width: 180px;
}

.add-report-view .add-report-perm-empty {
    color: #7A8599;
    font-size: 14px;
    font-family: var(--font-main);
    margin: 0;
}

.add-report-view .page-selection-section {
    max-width: none;
}

.add-report-view .pages-list.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Assign access sub-card */
.add-report-view .assign-access-card {
    background: #F8FAFB;
    border: 1px solid #E0E8F0;
    border-radius: 10px;
    padding: 16px;
    margin-top: 12px;
}

.add-report-view .permission-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 16px;
    margin-top: 0;
}

.add-report-view .permission-grid.perm-toggles-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.add-report-view .permission-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #22295C;
    font-family: var(--font-main);
}

.add-report-view .permission-item .toggle-switch {
    flex-shrink: 0;
}

.add-report-view .permission-item .toggle-switch[aria-checked="true"] {
    background: #65BDC6;
}

.add-report-view .add-report-perm-added-list {
    margin-top: 12px;
}

.add-report-view .add-report-perm-added-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #E0E8F0;
    font-family: var(--font-main);
    font-size: 14px;
}

.add-report-view .add-report-perm-added-row:last-child {
    border-bottom: none;
}

.add-report-view .add-report-perm-added-name {
    flex: 1;
    font-weight: 600;
    color: #22295C;
}

.add-report-view .add-report-perm-added-type {
    font-size: 12px;
    color: #7A8599;
}

.add-report-view .add-report-perm-remove-btn {
    font-family: var(--font-main);
    font-size: 13px;
    color: #7A8599;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
}

.add-report-view .add-report-perm-remove-btn:hover {
    color: #22295C;
    text-decoration: underline;
}

@media (max-width: 900px) {
    .add-report-card {
        flex-direction: column;
        min-height: 0;
        border-radius: 0 12px 12px 12px;
    }

    .add-report-left {
        border-right: none;
        border-bottom: 1px solid #E0E8F0;
    }

    .add-report-view .permission-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.wizard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.wizard-card {
    background: var(--color-bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wizard-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-dropdown);
}

.wizard-card .icon-circle {
    width: 60px;
    height: 60px;
    margin: 0 auto 0.75rem;
}

.wizard-card h3 {
    font-size: var(--font-size-body);
    font-weight: 600;
    color: var(--color-text-main);
    font-family: var(--font-main);
}

.wizard-summary {
    background: var(--color-bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    max-width: 480px;
    box-shadow: var(--shadow-card);
}

.wizard-summary .summary-row {
    margin-bottom: 1rem;
}

.wizard-summary .summary-row label {
    display: block;
    font-size: var(--font-size-body);
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
    font-family: var(--font-main);
}

.wizard-summary .summary-row span {
    font-size: var(--font-size-body);
    color: var(--color-text-main);
    font-family: var(--font-main);
}

.wizard-label {
    font-family: var(--font-main);
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-main);
}

.wizard-input {
    width: 100%;
    padding: var(--spacing-sm) 0.75rem;
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-sizing: border-box;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.wizard-input:focus {
    outline: none;
    border-color: var(--input-focus-border-color);
}

.wizard-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

/* Page selection step */
.page-selection-section {
    max-width: 480px;
}

.page-selection-desc {
    font-size: var(--font-size-body);
    font-family: var(--font-main);
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.page-selection-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.page-option-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: var(--font-size-body);
    font-family: var(--font-main);
}

.page-option-radio input {
    cursor: pointer;
}

.page-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.page-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: var(--font-size-body);
    font-family: var(--font-main);
}

.page-checkbox input {
    cursor: pointer;
}

.btn-secondary {
    background: var(--color-bg-card);
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-btn);
    padding: 0.5rem 1rem;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: background var(--transition-fast) ease, border-color var(--transition-fast) ease;
    font-family: var(--font-main);
}

.btn-secondary:hover {
    background: var(--color-bg-page);
    border-color: var(--color-primary);
}

.loading {
    padding: 1.5rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--font-size-body);
}

.error {
    padding: 1rem 1.5rem;
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-radius: var(--radius-card);
    font-size: var(--font-size-body);
    border: 1px solid var(--color-danger-border);
}

/* ============================================
   Power BI Embed
   ============================================ */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.viewer-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 96px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-bg-page);
}

#report-viewer-mount > .viewer-container {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.pbi-report-embed-card {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-card);
    border-radius: var(--radius-card);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    padding: 0;
    overflow: hidden;
}

.powerbi-embed-container {
    position: relative;
    z-index: 0;
    flex: 1;
    width: 100%;
    border: none;
    min-height: 0;
}

#report-container .powerbi-embed-container iframe {
    border: none;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-card);
    display: block;
    outline: none;
}

.pbi-loading-screen {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-card);
    gap: 1.25rem;
}

/* Loader logo pulse (scale only) — matches shared loader markup from loader.js */
@keyframes ci-loader-glow {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
    100% {
        transform: scale(1);
    }
}

#powerbi-loading {
    /* legacy selector kept for JS display toggling — layout handled by .pbi-loading-screen */
}

/* ---------------------------------------------------------------
   Reusable logo loader (.ci-loader); logo size + scale pulse animation.
   Use loaderHTML() and LOADER_LOGO_SRC from /app/js/utils/loader.js.
   For a full-page overlay, wrap in .pbi-loading-screen instead.
   --------------------------------------------------------------- */
.ci-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    min-height: 100px;
}

.ci-loader__logo {
    width: 96px;
    height: auto;
    animation: ci-loader-glow 2s ease-in-out infinite;
}

.ci-loader__label {
    font-size: var(--font-size-small);
    color: var(--color-text-muted);
    margin: 0;
    letter-spacing: 0.02em;
}

#report-container #powerbi-error {
    position: relative;
    z-index: 5;
    margin: 0;
    border-radius: 0;
    flex-shrink: 0;
}

/* ============================================
   Power BI report chrome (subtitle only; title in shell)
   ============================================ */

.pbi-report-chrome {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: var(--spacing-sm);
    flex-shrink: 0;
    padding: 12px 28px 0;
    background: var(--color-bg-page);
}

.pbi-report-chrome-text {
    min-width: 0;
    width: 100%;
    padding-bottom: 0;
}

.pbi-report-title {
    margin: 0;
    font-size: var(--font-size-page-title);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-main);
    line-height: 1.25;
}

.pbi-report-subtitle {
    margin: var(--spacing-xs) 0 0;
    font-size: var(--font-size-small);
    color: var(--color-text-muted);
    font-weight: var(--font-weight-regular);
}

.pbi-report-subtitle[hidden] {
    display: none;
}

/* Custom report page tabs (above embed card) */
#report-tabs,
.report-tabs-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 28px;
    flex-shrink: 0;
    background: transparent;
}

.report-tab {
    background: transparent;
    color: var(--color-text-main);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: 8px 20px;
    font-family: var(--font-main);
    font-size: var(--font-size-body);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    line-height: 1.2;
    transition: background var(--transition-fast) ease, color var(--transition-fast) ease, border-color var(--transition-fast) ease;
}

.report-tab:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.report-tab--active {
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    border-color: var(--color-primary);
}

/* Active tab: generic :hover sets teal text — keep on-primary on teal background */
.report-tab.report-tab--active:hover {
    background: var(--color-primary);
    color: var(--color-text-on-primary);
    border-color: var(--color-primary);
}

/* ============================================
   Power BI Controls Toolbar
   ============================================ */

.pbi-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

#pbi-unified-toolbar {
    position: relative;
    z-index: 35;
    isolation: isolate;
}

#pbi-unified-toolbar.pbi-toolbar {
    background: var(--bg-primary);
}

.pbi-toolbar-spacer {
    flex: 1 1 auto;
    min-width: var(--spacing-sm);
}

.pbi-actions-toolbar-slot {
    flex-shrink: 0;
}

.pbi-actions-dropdown-wrap {
    position: relative;
}

.pbi-actions-dropdown {
    position: absolute;
    top: calc(100% + var(--spacing-xs));
    left: 0;
    width: 200px;
    min-width: 200px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #f4f9fb;
    border: none;
    border-radius: 12px;
    box-shadow: 1px 1px 10px #00000029;
    z-index: 100;
    overflow: hidden;
}

.pbi-actions-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 8px 14px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 400;
    color: #22295c;
    cursor: pointer;
    font-family: var(--font-main);
    line-height: 1.35;
    white-space: nowrap;
    text-decoration: none;
}

.pbi-actions-menu-item:hover:not(:disabled) {
    background: #e8f2f4;
}

.pbi-actions-menu-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    color: #65bdc6;
}

.pbi-actions-menu-icon svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: block;
}

.pbi-actions-menu-icon img {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
}

.pbi-actions-menu-item--disabled .pbi-actions-menu-icon {
    color: var(--text-muted);
}

.pbi-actions-menu-item--disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.pbi-actions-divider {
    height: 0;
    margin: var(--spacing-xs) 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.pbi-toolbar-hidden-triggers {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.pbi-analytics-summary-row {
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-body);
    color: var(--text-secondary);
    line-height: 1.45;
}

.pbi-toolbar-btn {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-btn);
    padding: 0.35rem 0.75rem;
    font-size: var(--font-size-small);
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
    cursor: pointer;
    font-family: var(--font-main);
    transition: background var(--transition-fast) ease, box-shadow var(--transition-fast) ease, border-color var(--transition-fast) ease;
}

.pbi-toolbar-btn:hover {
    background: var(--color-bg-page);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-card);
}

.pbi-toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--color-bg-page);
}

.pbi-options-menu {
    position: relative;
}

.pbi-options-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.pbi-options-kebab {
    font-size: var(--font-size-body);
    line-height: 1;
    font-family: var(--font-main);
}

.pbi-options-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    min-width: 240px;
    background: var(--color-bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow-dropdown);
    border: 1px solid var(--color-border);
    z-index: 1000;
    overflow: hidden;
}

.pbi-options-dropdown.show {
    display: block;
}

.pbi-options-item {
    width: 100%;
    border: none;
    background: var(--color-bg-card);
    color: var(--color-text-main);
    font-size: var(--font-size-body);
    padding: 0.55rem 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-align: left;
    cursor: pointer;
    font-family: var(--font-main);
}

.pbi-options-item:hover {
    background: var(--color-bg-page);
}

.pbi-options-icon {
    width: 1rem;
    text-align: center;
    color: var(--color-primary);
}

.pbi-report-options-status {
    margin: 0.1rem 0.5rem 0.35rem;
    padding: 0.45rem 0.65rem;
    border-radius: 8px;
    font-size: var(--font-size-xs);
    font-family: var(--font-main);
    border: 1px solid transparent;
}

.pbi-report-options-status.loading {
    background: var(--color-bg-page);
    color: var(--color-primary);
    border-color: var(--color-border);
}

.pbi-report-options-status.success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: var(--color-success-border);
}

.pbi-report-options-status.error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: var(--color-danger-border);
}

/* ============================================
   Power BI Responsive
   ============================================ */

@media (max-width: 576px) {
    .pbi-report-chrome {
        padding: var(--spacing-sm) var(--spacing-md) 0;
    }

    .pbi-report-title {
        font-size: var(--font-size-md);
    }

    .pbi-toolbar-spacer {
        display: none;
    }

    .pbi-toolbar {
        gap: 0.35rem;
        padding: 0.35rem;
    }

    .pbi-toolbar-btn {
        padding: 0.3rem 0.5rem;
        font-size: var(--font-size-xs);
    }

    .report-tab {
        padding: 6px 14px;
        font-size: var(--font-size-small);
    }
}

@media (max-width: 768px) {
    #report-tabs,
    .report-tabs-wrap {
        flex-wrap: wrap;
        gap: 6px;
    }

    .report-tab {
        height: 40px;
        min-width: auto;
        padding: 0 14px;
        font-size: 14px;
    }

    #report-container,
    .viewer-container {
        height: calc(100vh - 200px);
        min-height: 300px;
    }
}

.report-admin-badge {
    margin-left: 0.5rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    font-family: var(--font-main);
    vertical-align: middle;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: var(--color-bg-page);
    color: var(--color-primary);
    border: 1px solid var(--color-border);
}

.report-card {
    position: relative;
}

.pbi-notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--color-danger);
    color: var(--color-white);
    font-size: var(--font-size-xs);
    font-family: var(--font-main);
    line-height: 16px;
    text-align: center;
}

.pbi-notif-bell-wrap .pbi-notif-bell-btn {
    position: relative;
}

.pbi-bookmark-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}
