/* ============================================
   Cognitive Science Collaboration Tool v7.0
   — Uni Wien Corporate Design compliant
   ============================================ */

/* CSS Variables */
:root {
    /* PRIMARY COLORS — Uni Wien */
    --color-univie-blue:      #005C99;
    --color-univie-blue-dark: #004A7A;

    /* TEXT */
    --color-text-primary:   #032138;
    --color-text-secondary: #666666;

    /* ACCENT (max 3) */
    --color-accent:         #005C99;   /* = univie-blue */
    --color-accent-hover:   #004A7A;   /* = univie-blue-dark */
    --color-accent-orange:  #FF8552;
    --color-accent-mint:    #2BA4A6;
    --color-accent-red:     #E65640;

    /* STATUS */
    --color-success: #2BA4A6;   /* Mint */
    --color-error:   #E65640;   /* Orange-red */

    /* BACKGROUND & BORDERS */
    --color-background:   #FFFFFF;
    --color-surface:      #F9FAFB;
    --color-border:       #E5E7EB;
    --color-border-light: #F3F4F6;

    /* TYPOGRAPHY */
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Source Serif 4', Georgia, serif;

    --font-xs:   0.75rem;    /* 12px */
    --font-sm:   0.875rem;   /* 14px */
    --font-base: 1rem;       /* 16px */
    --font-lg:   1.125rem;   /* 18px */
    --font-xl:   1.25rem;    /* 20px */
    --font-2xl:  1.5rem;     /* 24px */
    --font-3xl:  2rem;       /* 32px */

    /* LAYOUT */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    --transition: all 0.2s ease;

    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    --sidebar-width: 280px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: var(--font-base);
    line-height: 1.6;
    color: var(--color-text-primary);
    background-color: var(--color-background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-lg);
}

/* ============================================
   Hero Section
   ============================================ */

.hero-section {
    background: var(--color-surface);
    padding: 2.5rem 0;
}

.hero-container {
    text-align: center;
}

.hero-title {
    font-family: var(--font-sans);
    font-size: var(--font-3xl);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.01em;
}

.hero-subtitle {
    font-size: var(--font-lg);
    color: var(--color-text-secondary);
    margin-bottom: 0;
    font-weight: 400;
}

/* Fallback .link-secondary for any future use */
.link-secondary {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-sm);
    transition: color 0.2s;
}

.link-secondary:hover {
    color: var(--color-accent);
}

/* ============================================
   Help Banner
   ============================================ */

/* ============================================
   Return User Section
   ============================================ */

/* Fade in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* ============================================
   Main Content — Sidebar + Results Grid
   ============================================ */

.main-content {
    padding: var(--spacing-lg) 0;
    background: #fafbfc;
}

.content-grid {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: var(--spacing-lg);
    align-items: start;
}

/* ============================================
   Filter Sidebar
   ============================================ */

.filter-sidebar {
    position: sticky;
    top: var(--spacing-sm);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-background);
    z-index: 1;
}

.sidebar-header h3 {
    font-size: var(--font-base);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.sidebar-body {
    padding: var(--spacing-sm);
}

/* Filter Group */
.filter-group {
    margin-bottom: 1.25rem;
}

.filter-group > .filter-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 0.375rem;
}

/* Rich tooltip (hover-based, supports HTML content) */
.rich-tooltip-wrap {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
}

.rich-tooltip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: #bdc3cb;
    color: #2c3e50;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
    transition: background 0.15s ease, color 0.15s ease;
    line-height: 1;
    padding: 0;
    font-family: inherit;
}

.rich-tooltip-btn:hover,
.rich-tooltip-btn:focus {
    background: #3498db;
    color: white;
    outline: none;
}

.rich-tooltip {
    display: none;
    position: fixed;
    background: #2c3e50;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
    width: 230px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    z-index: 10002;
    font-weight: 400;
}

.rich-tooltip p {
    margin: 0 0 7px;
}

.rich-tooltip p:last-child {
    margin-bottom: 0;
}

.rich-tooltip strong {
    color: #ffffff;
    font-weight: 700;
}

/* Filter logic inside Methods section */
.filter-logic-inline {
    padding: 0.35rem 0.5rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0.125rem;
}

.filter-logic-inline-label {
    display: flex;
    align-items: center;
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
}

/* Filter logic toggle */
.filter-logic-toggle {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.filter-logic-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.filter-logic-option:hover {
    background: var(--color-surface);
}

.filter-logic-option input[type="radio"] {
    margin-right: 0.5rem;
    cursor: pointer;
    accent-color: var(--color-accent);
}

.filter-logic-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--color-text-primary);
}

.filter-logic-option span {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
}

/* Collapsible filter group header */
.filter-group-header {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.filter-group-header:hover {
    background: var(--color-border-light);
}

.filter-group-header .filter-label {
    flex: 1;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    margin: 0;
}

.filter-badge {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    background: white;
    border: 1px solid var(--color-border);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-right: 0.5rem;
}

.filter-toggle-icon {
    font-size: 0.65rem;
    color: var(--color-text-secondary);
    transition: transform 0.2s ease;
}

.filter-group-header.expanded .filter-toggle-icon {
    transform: rotate(180deg);
}

/* Collapsible filter body — height animation managed by JS */
.filter-group-body {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.filter-group-body.collapsed {
    max-height: 0;
}

/* .expanded: JS sets max-height and switches overflow to visible after animation */

/* Filter helper text */
.filter-helper-text {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    margin: 0.25rem 0.5rem 0.5rem;
    line-height: 1.4;
}

/* Filter Actions (All / None) */
.filter-actions {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 0.5rem 0.25rem;
}

.filter-actions .link-button {
    color: var(--color-text-secondary);
    font-size: 0.75rem;
}

.filter-actions .link-button:hover {
    color: var(--color-text-primary);
    text-decoration: underline;
}

/* Filter list search */
.filter-list-search {
    width: calc(100% - 1rem);
    margin: 0.25rem 0.5rem 0.5rem;
    padding: 0.375rem 0.5rem;
    font-size: var(--font-xs);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    font-family: var(--font-sans);
}

.filter-list-search:focus {
    outline: 2px solid var(--color-univie-blue);
    outline-offset: -2px;
    border-color: var(--color-univie-blue);
}

.filter-list-search::placeholder {
    color: var(--color-text-secondary);
    opacity: 0.6;
}

.no-match-message {
    padding: 0.75rem 0.5rem;
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    text-align: center;
    font-style: italic;
}

/* Quick-select chips */
.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.25rem 0.5rem 0.5rem;
}

.chip {
    background: #E8F4F8;
    color: var(--color-univie-blue);
    border: none;
    padding: 0.2rem 0.625rem;
    border-radius: 12px;
    font-size: var(--font-xs);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.chip:hover {
    background: #D0E8F2;
}

.chip.active {
    background: var(--color-univie-blue);
    color: white;
}

.chip.active:hover {
    background: var(--color-univie-blue-dark);
}

/* Checkbox list */
.checkbox-list {
    padding: 0.25rem 0;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    transition: background 0.15s;
    background: var(--color-background);
}

.checkbox-item:hover {
    background: var(--color-surface);
}

.checkbox-item input[type="checkbox"] {
    margin-right: 0.625rem;
    cursor: pointer;
    accent-color: var(--color-accent);
}

.checkbox-item label {
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    margin: 0;
    flex: 1;
}

/* Categorized methods */
.filter-category {
    margin-bottom: 0.25rem;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0.5rem;
    background: var(--color-border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    user-select: none;
    transition: background 0.15s;
}

.category-header:hover {
    background: var(--color-border);
}

.category-header.all-selected {
    background: rgba(0, 92, 153, 0.08);
    border: 1px solid var(--color-univie-blue);
    color: var(--color-univie-blue);
}

.category-header-content {
    flex: 1;
}

.category-actions {
    display: flex;
    gap: 0.2rem;
    margin-left: 0.5rem;
}

.category-action-btn {
    background: white;
    border: 1px solid var(--color-border);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    cursor: pointer;
    transition: var(--transition);
    color: var(--color-text-secondary);
}

.category-action-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.category-body {
    padding-left: var(--spacing-sm);
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.category-body.collapsed {
    max-height: 0;
    margin-top: 0;
}

.category-body.expanded {
    max-height: 2000px;
    margin-top: 0.25rem;
}

/* Sidebar scrollbar */
.filter-sidebar::-webkit-scrollbar {
    width: 6px;
}

.filter-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.filter-sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.filter-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-secondary);
}

/* Highlight pulse for tag-click */
.highlight-pulse {
    animation: highlightPulse 1.5s ease;
}

@keyframes highlightPulse {
    0%, 100% { background: transparent; }
    50% { background: #FEF3C7; }
}

/* ============================================
   Link Button (generic) & Footer link
   ============================================ */

.link-button {
    background: none;
    border: none;
    color: var(--color-accent);
    font-size: var(--font-xs);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: var(--transition);
    font-family: inherit;
}

.link-button:hover {
    text-decoration: underline;
    color: var(--color-accent-hover);
}

.footer-link-btn {
    font-size: var(--font-sm);
    color: var(--color-accent);
    padding: 0;
}

/* ============================================
   Results Area
   ============================================ */

.results-area {
    min-width: 0; /* prevent grid blowout */
}

/* Active filter chips */
.active-filters {
    min-height: 30px;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.active-filters-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    min-height: 26px;
}

.active-filters-empty {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    opacity: 0.65;
    line-height: 1.4;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #E8F4F8;
    border: 1px solid var(--color-univie-blue);
    border-radius: 10px;
    padding: 0.2rem 0.6rem;
    font-size: var(--font-xs);
    color: var(--color-univie-blue);
    font-weight: 500;
    line-height: 1.4;
}

.filter-chip-remove {
    background: none;
    border: none;
    color: var(--color-univie-blue);
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.filter-chip-remove:hover {
    opacity: 1;
}

.filter-chip-ai {
    background: #FFF4E6;
    border-color: var(--color-accent-orange);
    color: #D97706;
}

.ai-sort-notice {
    margin: 0;
    font-size: var(--font-xs);
    color: #D97706;
    background: #FFF4E6;
    border: 1px solid var(--color-accent-orange);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.6rem;
    display: inline-block;
    white-space: nowrap;
}

.filter-chip-ai .filter-chip-remove {
    color: #D97706;
}

/* ============================================
   AI Recommended Chip (Persistent Mode)
   ============================================ */

.ai-recommended-chip-container {
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-recommended-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #FFF4E6;
    border: 2px solid var(--color-accent-orange);
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    font-weight: 600;
    color: #D97706;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-recommended-chip:hover {
    background: #FFEDD5;
    border-color: #F59E0B;
}

.ai-recommended-chip.selected {
    background: var(--color-accent-orange);
    border-color: var(--color-accent-orange);
    color: white;
}

.ai-chip-icon {
    font-size: 1rem;
    line-height: 1;
}

.ai-chip-label {
    font-weight: 600;
}

.ai-chip-x {
    margin-left: 3px;
    font-size: 1rem;
    opacity: 0.8;
    font-weight: 400;
}

.ai-recommended-chip.selected:hover .ai-chip-x {
    opacity: 1;
}

.ai-chip-clear {
    background: transparent;
    border: 2px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.ai-chip-clear:hover {
    background: var(--color-surface);
    border-color: var(--color-error);
    color: var(--color-error);
}

/* Results header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    position: sticky;
    top: 0;
    z-index: 10;
    background: #fafbfc;
}

/* Results controls (Sort + View toggle) */
.results-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Sort control */
.sort-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sort-label {
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    white-space: nowrap;
}

/* Custom sort dropdown */
.sort-custom {
    position: relative;
}

.sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.6rem;
    background: white;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: var(--font-sm);
    font-family: inherit;
    color: var(--color-text-primary);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.3;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.sort-btn:hover {
    border-color: var(--color-univie-blue);
}

.sort-btn[aria-expanded="true"] {
    border-color: var(--color-univie-blue);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-univie-blue) 12%, transparent);
}

.sort-btn-label {
    font-weight: 500;
}

.sort-btn-dir {
    font-size: 0.75rem;
    color: var(--color-univie-blue);
    font-weight: 700;
    min-width: 0.65rem;
    text-align: center;
}

.sort-btn-chevron {
    color: var(--color-text-secondary);
    margin-left: 0.15rem;
    flex-shrink: 0;
    transition: transform 0.15s;
}

.sort-btn[aria-expanded="true"] .sort-btn-chevron {
    transform: rotate(180deg);
}

.sort-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 200;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 175px;
    padding: 0.3rem 0;
    overflow: hidden;
}

.sort-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.45rem 0.85rem;
    background: none;
    border: none;
    font-size: var(--font-sm);
    font-family: inherit;
    color: var(--color-text);
    cursor: pointer;
    gap: 0.5rem;
    transition: background 0.1s;
}

.sort-option:hover {
    background: #f4f7fb;
}

.sort-option.is-active {
    color: var(--color-univie-blue);
    font-weight: 500;
    background: color-mix(in srgb, var(--color-univie-blue) 6%, transparent);
}

.sort-option-dir {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-univie-blue);
    min-width: 0.65rem;
    text-align: right;
}

.sort-option-badge {
    font-size: var(--font-xs);
    background: color-mix(in srgb, var(--color-univie-blue) 10%, transparent);
    color: var(--color-univie-blue);
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    font-weight: 500;
}

.sort-panel-divider {
    height: 1px;
    background: var(--color-border);
    margin: 0.25rem 0;
}

/* Faculty section wrapper — one per faculty group */
.faculty-section {
    /* no margin — spacing handled by profile-cards-inner padding-bottom */
}

/* Faculty group header — plain block, sticky within its section */
.faculty-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.85rem;
    background: var(--group-bg, #f0f0f0);
    border-left: 3px solid var(--group-border, #aaa);
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--group-text, #555);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    /* Sticky — no margin above means no gap when header sticks */
    position: sticky;
    top: var(--faculty-sticky-top, 0px);
    z-index: 8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Seal the 1-2px subpixel gap between the sticky header and the results-header above */
.faculty-group-header::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -3px;
    right: 0;
    height: 2px;
    background: var(--group-bg, #f0f0f0);
}

/* Cards grid within a faculty section */
.profile-cards-inner {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) 0 0.85rem; /* bottom padding = gap between sections */
}

/* Outer container becomes block flow when faculty-grouped */
.profile-cards.view-faculty-grouped {
    display: block;
}

.faculty-group-count {
    font-weight: 400;
    font-size: var(--font-xs);
    opacity: 0.7;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.faculty-group-header > span:first-child {
    flex: 1;
    min-width: 0;
}

.results-count {
    font-family: var(--font-sans);
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.count-number {
    font-weight: 700;
    color: var(--color-text-primary);
}

.count-number.filtered {
    color: var(--color-univie-blue);
}

/* Generate Search Prompt button in header */
.results-header .btn-primary {
    white-space: nowrap;
}

/* View toggle (Grid / List) */
.view-toggle {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.view-toggle-btn {
    background: var(--color-background);
    border: none;
    padding: 0.4rem 0.875rem;
    font-size: var(--font-sm);
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.view-toggle-btn:hover {
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.view-toggle-btn.active {
    background: var(--color-univie-blue);
    color: white;
}

.badge-count {
    display: inline;
    font-size: var(--font-xs);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.72);
    margin-left: 0.4rem;
    letter-spacing: 0.01em;
}

/* ============================================
   Current Opportunities Panel
   ============================================ */

.opportunities-panel-top {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: var(--spacing-md) 0;
}

.opportunities-panel-top .opportunities-header {
    padding: 0;
    border-bottom: none;
}

.opportunities-panel-top .opportunities-content {
    padding: var(--spacing-sm) 0 0;
}

.opportunities-panel-top .opportunities-content .opportunity-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .opportunities-panel-top .opportunities-content .opportunity-item {
        grid-template-columns: 1fr;
    }
    .opportunities-panel-top .opportunities-content .opportunity-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* Legacy opportunities panel (kept for backward compatibility) */
.opportunities-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.opportunities-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    width: 100%;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.opportunities-header:hover {
    background: none;
}

.opportunities-header:focus-visible {
    outline: 2px solid var(--color-univie-blue);
    outline-offset: -2px;
}

.opportunities-header h3 {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

.opportunities-chevron {
    flex-shrink: 0;
    color: var(--color-text-secondary);
    transition: transform 0.2s ease;
}

.opportunities-header.is-open .opportunities-chevron {
    transform: rotate(180deg);
}

.opportunities-content {
    padding: 1rem 1.25rem;
}

.opportunity-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.opportunity-item:last-child {
    margin-bottom: 0;
}

.opportunity-info {
    flex: 1;
}

.opportunity-title {
    font-size: var(--font-base);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 0.25rem;
}

.opportunity-description {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: 0 0 0.5rem;
    line-height: 1.5;
}

.opportunity-meta {
    display: flex;
    gap: 0.75rem;
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
}

.opportunity-meta span {
    display: flex;
    align-items: center;
}

.opportunity-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-self: center;
}

.opportunity-actions a.btn {
    text-decoration: none;
}

.opportunity-action {
    flex-shrink: 0;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 2px dashed var(--color-border);
}

.empty-state h3 {
    font-size: var(--font-xl);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 0.5rem 0;
}

.empty-state p {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    margin: 0 0 var(--spacing-md) 0;
}

.empty-state-actions {
    margin-top: var(--spacing-md);
}

.empty-state-help {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin-top: 0.75rem;
    margin-bottom: 0;
}

/* ============================================
   Profile Cards
   ============================================ */

.profile-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

/* List view layout */
.profile-cards.view-list {
    grid-template-columns: 1fr;
}

.view-list .profile-card {
    flex-direction: row;
    align-items: stretch;
    padding: 0.9rem 1rem;
}

/* Grid layout: avatar column | content column */
.view-list .card-main {
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-auto-rows: auto; /* Let rows auto-size based on content */
    column-gap: 1.25rem;
    row-gap: 0.3rem;
    flex: 1;
}

/* Unwrap card-header so avatar and card-info become direct grid children */
.view-list .card-header {
    display: contents;
}

/* Avatar in column 1, spanning all rows, centered vertically */
.view-list .avatar-circle {
    grid-column: 1;
    grid-row: 1 / -1; /* From first to last row */
    align-self: center;
    width: 48px;
    height: 48px;
    font-size: var(--font-base);
}

/* Content wrapper - all text items */
.view-list .card-info {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    padding-top: 0.25rem;
}

/* Name, title, and field wrap freely — no ellipsis (Task E) */
.view-list .card-name {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    margin: 0;
    line-height: 1.4;
}

.view-list .card-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    margin: 0;
    line-height: 1.4;
}

.view-list .card-field {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    margin: 0;
    line-height: 1.4;
}

/* AI badge styling */
.card-ai-badge {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    background: #FFF4E6;
    border-left: 3px solid var(--color-accent-orange);
    color: #D97706;
    font-size: 0.8125rem;
    font-weight: 600;
    margin: 0.25rem 0;
    border-radius: var(--radius-sm);
    line-height: 1.4;
}

/* AI badge in list view - inline like method tags */
.view-list .card-ai-badge {
    grid-column: 2;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    margin: 0;
    border-radius: 4px;
    line-height: 1.5;
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
}

/* Methods wrap into multiple rows; each tag shows full text */
.view-list .card-methods {
    grid-column: 2;
    flex: none;
    padding: 0 0 0.2rem 0;
    flex-wrap: wrap;
    overflow: visible;
    min-height: auto;
    align-items: flex-start;
    gap: 0.25rem;
}

.view-list .tag {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
}

.view-list .card-actions {
    border-top: none;
    border-left: 1px solid var(--color-border-light);
    margin-top: 0;
    padding: var(--spacing-sm);
    justify-content: center;
    align-items: center;
}

.profile-card {
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
}

.profile-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    cursor: pointer;
}

.card-header {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    padding-bottom: 0;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-univie-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-sm);
    font-weight: 600;
    flex-shrink: 0;
    letter-spacing: -0.5px;
    overflow: hidden;
}
.avatar-circle--sm { font-size: 0.65rem; letter-spacing: -0.5px; }

.avatar-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.card-info {
    flex: 1;
    min-width: 0;
}


/* In grid view this wrapper is invisible; list view promotes it to the content column */
.card-main {
    display: contents;
}

.card-name {
    font-size: var(--font-base);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 0.2rem 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-title {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    margin: 0 0 0.2rem 0;
    font-style: italic;
}

.card-field {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-snippet {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* List view: allow 2 lines for snippet */
.view-list .card-snippet {
    -webkit-line-clamp: 2;
}

/* AI rank badge on card */
.card-ai-rank {
    display: inline-block;
    background: var(--color-accent-orange);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    margin-left: 0.4rem;
    vertical-align: middle;
    line-height: 1.6;
}

/* Method tags on card */
.card-methods {
    padding: 0.625rem var(--spacing-sm) 0.5rem;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.25rem;
    flex: 1;
    overflow: hidden;
    align-items: center;
    min-height: 2rem;
}

/* Hide methods in grid view (Task C) */
.profile-cards:not(.view-list) .card-methods {
    display: none;
}

/* Sidebar AI recommendation section */
.sidebar-ai-section {
    background: #FFF4E6;
    border-left: 4px solid var(--color-accent-orange);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.sidebar-ai-section h4 {
    color: #D97706;
    margin-bottom: 0.75rem;
    font-size: var(--font-base);
    font-weight: 600;
}

.sidebar-ai-reason-header {
    font-size: var(--font-sm);
    font-weight: 600;
    color: #92400E;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-size: 0.6875rem;
}

.sidebar-ai-reason-text {
    font-size: var(--font-sm);
    color: #78350F;
    line-height: 1.7;
    background: #FFF8F0;
    border: 1px solid #F0D8C0;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin: 0;
}

.sidebar-ai-reason-list {
    font-size: var(--font-sm);
    color: #78350F;
    line-height: 1.7;
    background: #FFF8F0;
    border: 1px solid #F0D8C0;
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.75rem 0.75rem 2rem;
    margin: 0;
    list-style-type: disc;
}

.sidebar-ai-reason-list li {
    margin-bottom: 0.5rem;
    padding-left: 0.25rem;
}

.sidebar-ai-reason-list li:last-child {
    margin-bottom: 0;
}

.sidebar-ai-fallback {
    font-size: var(--font-sm);
    color: #92400E;
    font-style: italic;
    margin: 0;
}

.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: var(--font-xs);
    font-weight: 500;
    white-space: nowrap;
    border: none;
    border-left: 3px solid transparent;
    font-family: inherit;
    line-height: 1;
    cursor: default;
    background: #F3F4F6;
    color: #374151;
    min-width: 0;
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-neuroimaging  { border-left-color: var(--color-univie-blue); }
.tag-eye           { border-left-color: #6366F1; }
.tag-behavioral    { border-left-color: var(--color-accent-mint); }
.tag-computational { border-left-color: var(--color-univie-blue-dark); }
.tag-specialized   { border-left-color: var(--color-accent-red); }
.tag-other         { border-left-color: #9CA3AF; }

/* Colored category headers in methods filter (9 categories + other) */
.category-header.cat-neuro         { background: rgba(192,84,110,0.10);  border-left: 3px solid #C0546E; color: #9E3A52; }
.category-header.cat-brainstim     { background: rgba(184,90,56,0.10);   border-left: 3px solid #B85A38; color: #924020; }
.category-header.cat-eye           { background: rgba(106,148,56,0.10);  border-left: 3px solid #6A9438; color: #4E7820; }
.category-header.cat-behavioral    { background: rgba(58,140,86,0.10);   border-left: 3px solid #3A8C56; color: #246840; }
.category-header.cat-selfreport    { background: rgba(46,136,120,0.10);  border-left: 3px solid #2E8878; color: #186658; }
.category-header.cat-computational { background: rgba(78,120,176,0.10);  border-left: 3px solid #4E78B0; color: #325E96; }
.category-header.cat-physiological { background: rgba(110,100,176,0.10); border-left: 3px solid #6E64B0; color: #524898; }
.category-header.cat-acoustic      { background: rgba(144,74,168,0.10);  border-left: 3px solid #904AA8; color: #6E2E88; }
.category-header.cat-synthesis     { background: rgba(176,72,120,0.10);  border-left: 3px solid #B04878; color: #8E2C5C; }
.category-header.cat-other         { background: var(--color-border-light); }

.category-header.cat-neuro:hover         { background: rgba(192,84,110,0.18); }
.category-header.cat-brainstim:hover     { background: rgba(184,90,56,0.18); }
.category-header.cat-eye:hover           { background: rgba(106,148,56,0.18); }
.category-header.cat-behavioral:hover    { background: rgba(58,140,86,0.18); }
.category-header.cat-selfreport:hover    { background: rgba(46,136,120,0.18); }
.category-header.cat-computational:hover { background: rgba(78,120,176,0.18); }
.category-header.cat-physiological:hover { background: rgba(110,100,176,0.18); }
.category-header.cat-acoustic:hover      { background: rgba(144,74,168,0.18); }
.category-header.cat-synthesis:hover     { background: rgba(176,72,120,0.18); }

.tag-more {
    color: #999;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0 0.1rem;
    flex-shrink: 0;
    cursor: default;
    white-space: nowrap;
    align-self: center;
    text-decoration: underline dotted #ccc;
    text-underline-offset: 2px;
}
.tag-more:hover {
    color: #666;
    text-decoration: underline dotted #999;
}

.tag-more-popover {
    display: none;
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    padding: 0.65rem 0.9rem;
    box-shadow: 0 4px 18px rgba(0,0,0,0.11);
    max-width: 360px;
    min-width: 200px;
    pointer-events: auto;
}
.tag-more-popover-label {
    font-size: 0.68rem;
    color: #999;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}
.tag-more-popover-group {
    margin-bottom: 0.5rem;
}
.tag-more-popover-group:last-child { margin-bottom: 0; }
.tag-more-popover-cat {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #bbb;
    margin-bottom: 0.25rem;
}
.tag-more-popover-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.tag-more-popover .tag {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
}

.tag-placeholder {
    color: var(--color-text-secondary);
    font-size: var(--font-xs);
    font-style: italic;
}

/* Card action buttons */
.card-actions {
    display: flex;
    gap: 0.5rem;
    padding: var(--spacing-xs) var(--spacing-sm) var(--spacing-sm);
    border-top: 1px solid var(--color-border-light);
    margin-top: auto;
}

.card-actions .btn {
    flex: 1;
    font-size: var(--font-sm);
    padding: 0.4rem 0.5rem;
}

/* ============================================
   Mobile Filter Toggle
   ============================================ */

.mobile-filter-toggle {
    display: none;
    position: fixed;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-text-primary);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 1rem 1.5rem;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 100;
    gap: 0.75rem;
    align-items: center;
}

.filter-btn-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
}

.filter-btn-title {
    font-size: var(--font-base);
    font-weight: 600;
}

.filter-btn-hint {
    font-size: var(--font-xs);
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.mobile-filter-toggle .toggle-icon {
    font-size: 1rem;
    opacity: 0.7;
}

.mobile-filter-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: var(--font-xs);
}

/* ============================================
   Sidebar Overlay (mobile filter backdrop)
   ============================================ */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   Profile Detail Sidebar (right slide-in)
   ============================================ */

.profile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.profile-sidebar-overlay.active {
    display: block;
}

.profile-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 560px;
    max-width: 90vw;
    height: 100%;
    background: white;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.profile-sidebar.open {
    transform: translateX(0);
}

.sidebar-close {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: flex-end;
    background: white;
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem var(--spacing-sm);
    z-index: 1;
}

.profile-sidebar > .sidebar-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0.5rem 0.75rem;
    margin: -0.5rem -0.75rem 0 0;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}

.profile-sidebar > .sidebar-close:hover {
    color: var(--color-error);
}

.sidebar-content {
    padding: var(--spacing-lg) var(--spacing-md);
}

/* Profile sidebar detail layout */
.sidebar-profile-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: var(--spacing-md);
}

.sidebar-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--color-univie-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-avatar--sm { font-size: 1.1rem; }

.sidebar-profile-info h2 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.2;
    margin: 0.15rem 0 0.15rem 0;
}

.sidebar-academic-title {
    display: block;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    font-style: italic;
    margin: 0 0 0.1rem 0;
    line-height: 1.4;
}

.sidebar-profile-info .sidebar-field-label {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.sidebar-detail-section {
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border-light);
}

.sidebar-detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sidebar-detail-section h4 {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.5rem 0;
}

.sidebar-detail-row {
    display: block;
    padding: 0.5rem 0;
}

.sidebar-detail-label {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 0.25rem;
}

.sidebar-detail-value {
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    text-align: left;
    word-break: break-word;
    line-height: 1.6;
    display: block;
}

.sidebar-detail-value a {
    color: var(--color-accent);
    text-decoration: none;
}

.sidebar-detail-value a:hover {
    text-decoration: underline;
}


/* AI recommendation in profile sidebar */
.sidebar-ai-rank {
    color: var(--color-accent-orange);
    font-weight: 600;
}

.sidebar-ai-reason {
    background: #FFF8F0;
    border: 1px solid #F0D8C0;
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.75rem;
    font-size: var(--font-sm);
    color: #78350F;
    line-height: 1.5;
    margin-top: 0.5rem;
}

/* Method tags in sidebar */
.sidebar-methods {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}
.sidebar-method-group {
    width: 100%;
    margin-bottom: 0.65rem;
}
.sidebar-method-group:last-child { margin-bottom: 0; }
.sidebar-method-group-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #aaa;
    margin-bottom: 0.3rem;
}
.sidebar-method-group-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.sidebar-methods .tag {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    word-break: break-word;
    line-height: 1.4;
    text-align: left;
}

/* Representative papers in sidebar */
.sidebar-papers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-paper {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-paper-header {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.sidebar-paper-num {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    min-width: 1rem;
    padding-top: 0.15rem;
}

.sidebar-paper-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 0;
}

.sidebar-paper-title {
    font-size: var(--font-sm);
    color: var(--color-univie-blue);
    text-decoration: none;
    line-height: 1.4;
}

.sidebar-paper-title:hover {
    text-decoration: underline;
}

.sidebar-paper-ext {
    font-size: 0.7em;
    margin-left: 2px;
    opacity: 0.7;
    vertical-align: super;
}

.sidebar-paper-badges {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-top: 0.1rem;
}

.sidebar-paper-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    line-height: 1.5;
}

.sidebar-paper-badge--oa {
    background: #e07b00;
    color: #fff;
}

.sidebar-paper-meta {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
}

.sidebar-paper-note {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    font-style: italic;
    margin-top: 0.1rem;
}

/* External profile links */
.external-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.external-link-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    text-decoration: none;
    font-size: var(--font-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.external-link-btn:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: translateX(2px);
}

.external-link-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.external-link-icon-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--color-univie-blue);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 92, 153, 0.3);
}

.btn-primary:hover {
    background-color: var(--color-univie-blue-dark);
    box-shadow: 0 4px 12px rgba(0, 92, 153, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: transparent;
    color: #6B7280;
    border: 1px solid var(--color-border);
    box-shadow: none;
}

.btn-secondary:hover {
    background: var(--color-surface);
    border-color: #9CA3AF;
    color: #374151;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--font-sm);
    font-weight: 400;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================
   Form Elements
   ============================================ */

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-xs);
}

select.input {
    cursor: pointer;
    margin-bottom: var(--spacing-xs);
}

.optional-label {
    color: var(--color-text-secondary);
    font-weight: 400;
}

.input,
.textarea {
    width: 100%;
    padding: var(--spacing-sm);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--color-text-primary);
    background-color: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.input:focus-visible,
.textarea:focus-visible {
    outline: none;
    border-color: var(--color-univie-blue);
    box-shadow: 0 0 0 3px rgba(0, 92, 153, 0.15);
}

.input-inline-error {
    font-size: var(--font-sm);
    color: var(--color-accent-red);
    margin-top: 0.35rem;
    margin-bottom: 0;
}

.input.input-error,
.textarea.input-error {
    border-color: var(--color-accent-red);
    box-shadow: 0 0 0 3px rgba(230, 86, 64, 0.15);
    animation: shake 0.35s ease;
}

@keyframes shake {
    0%  { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
    100%{ transform: translateX(0); }
}

.btn:focus-visible,
.chip:focus-visible,
.tag:focus-visible,

.filter-group-header:focus-visible,
.category-header:focus-visible,
.link-button:focus-visible,
.filter-chip-remove:focus-visible,
.view-toggle-btn:focus-visible {
    outline: 2px solid var(--color-univie-blue);
    outline-offset: 2px;
}

.input-sm {
    padding: 0.5rem 0.75rem;
    font-size: var(--font-sm);
}

.textarea {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   Modal System
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    display: block;
}

.prompt-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: var(--transition);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close-btn:hover {
    color: var(--color-error);
    background: #FEF2F2;
}

/* Modal header */
.modal-header {
    padding: var(--spacing-xl) var(--spacing-xl) 0;
}

.modal-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.modal-header h2 {
    font-size: var(--font-2xl);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
    padding-right: 2rem;
}

/* Guide button */
.btn-guide {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.75rem;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-guide:hover {
    background: var(--color-surface);
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
}

.btn-guide:focus-visible {
    outline: 2px solid var(--color-univie-blue);
    outline-offset: 2px;
}

/* Guide panel */
.modal-guide-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: var(--spacing-md);
}

.modal-guide-panel h4 {
    font-size: var(--font-base);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 0.75rem;
}

.guide-steps {
    margin: 0;
    padding-left: 1.5rem;
}

.guide-steps li {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.guide-steps li:last-child {
    margin-bottom: 0;
}

.guide-sections {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.guide-section p {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin: 0;
}

.guide-section-title {
    font-weight: 600;
    color: var(--color-text-primary) !important;
    margin-bottom: 0.2rem !important;
}

/* Modal body */
.modal-body {
    padding: 0.75rem var(--spacing-xl) var(--spacing-xl);
}

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

/* Info card (Tab 1) */
.info-card {
    background: #E8F4F8;
    border: 1px solid #C5DDE8;
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-bottom: var(--spacing-md);
}

.info-content p {
    margin: 0;
    font-size: var(--font-sm);
    color: var(--color-text-primary);
}

.info-subtitle {
    color: var(--color-text-secondary) !important;
    margin-top: 0.2rem;
}

.filter-tip {
    font-size: var(--font-xs);
    color: var(--color-univie-blue);
    font-weight: 500;
    margin-top: 0.5rem !important;
}

/* Modal filters summary */
.modal-filters-summary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: var(--spacing-md);
}

.modal-filters-summary h4 {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.modal-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.modal-filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    font-size: var(--font-xs);
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
}

.modal-filter-note {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    font-style: italic;
}

/* Info box (Tab 2) */
.info-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-bottom: var(--spacing-md);
}

.info-box p {
    margin: 0;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
}

/* LLM workflow cycle guide (Paste recommendations tab) */
/* LLM workflow cycle guide (Paste recommendations tab) */
.llm-cycle-guide {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: var(--spacing-md);
}

.cycle-step {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-bottom: 0.5rem;
}

.cycle-step:last-child {
    margin-bottom: 0;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    background: var(--color-univie-blue);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.step-text {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.llm-paste-help {
    margin-top: 0.75rem;
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    line-height: 1.5;
}

.llm-paste-help strong {
    color: #10a37f;
    font-weight: 600;
}

/* Prompt output */

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 260px;
    max-width: 360px;
    animation: toast-slide-in 0.3s ease-out;
    pointer-events: auto;
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-error   { border-left: 4px solid var(--color-error); }
.toast-info    { border-left: 4px solid var(--color-accent); }

.toast-icon {
    font-size: 1rem;
    flex-shrink: 0;
    font-weight: 600;
    width: 1.25rem;
    text-align: center;
}

.toast-success .toast-icon { color: var(--color-success); }
.toast-error   .toast-icon { color: var(--color-error); }
.toast-info    .toast-icon { color: var(--color-accent); }

.toast-message {
    flex: 1;
    font-size: 0.9375rem;
    color: #1F2937;
}

.toast-close {
    background: none;
    border: none;
    color: #6B7280;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #374151;
}

@keyframes toast-slide-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.toast-fadeout {
    animation: toast-fade-out 0.3s ease-out forwards;
}

@keyframes toast-fade-out {
    to { opacity: 0; transform: translateX(120%); }
}

/* ============================================
   Footer
   ============================================ */

.footer {
    padding: var(--spacing-md) 0;
    padding-top: calc(var(--spacing-md) + 1.5rem);
    border-top: 1px solid var(--color-border);
    text-align: center;
    background: var(--color-background);
}

.footer p {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.footer-note {
    font-size: var(--font-xs) !important;
    color: var(--color-text-secondary);
}

.footer-admin-link {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    text-decoration: none;
    opacity: 0.15;
    transition: opacity 0.2s;
}
.footer:hover .footer-admin-link,
.footer-admin-link:focus { opacity: 0.6; }

/* ============================================
   Utility Classes
   ============================================ */

.hidden {
    display: none !important;
}

/* ============================================
   Matching Summary Panel (Paste Recommendations)
   ============================================ */

.matching-summary {
    margin-top: var(--spacing-md);
    padding: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}

.matching-summary-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 1rem;
}

.matching-summary-stats {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.summary-stat {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.summary-stat-warning {
    border-left: 3px solid var(--color-accent-orange);
}

.summary-stat-error {
    border-left: 3px solid #dc2626;
}

.stat-label {
    font-size: var(--font-base);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--color-text-primary);
}

.stat-value-block {
    text-align: right;
}

.matched-names,
.notfound-names {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin-top: 0.5rem;
    max-width: 400px;
    word-wrap: break-word;
    line-height: 1.4;
}

.summary-stat-success {
    border-left: 3px solid #28a745;
}

/* ============================================
   Disambiguation UI (Direct Search tab)
   ============================================ */

/* Filter Warning Dialog (for AI analysis) */
.filter-warning-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1100;
    backdrop-filter: blur(2px);
}

.filter-warning-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1101;
    max-width: 480px;
    width: 90%;
    background: white;
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.filter-warning-dialog h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 12px 0;
}

.filter-warning-message {
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-secondary);
    margin: 0 0 20px 0;
}

.filter-warning-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-warning-actions .btn-text {
    align-self: center;
    margin-top: 4px;
}

.filter-warning-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6em;
    padding: 0.05em 0.45em;
    background: rgba(0, 92, 153, 0.1);
    color: var(--color-univie-blue);
    border-radius: 100px;
    font-size: 0.85em;
    font-weight: 600;
    line-height: 1.6;
}

/* Filter scope dialog — pills */
.fw-pills {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.fw-pill-group {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.fw-pill-group-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 0.3rem;
    min-width: 52px;
    flex-shrink: 0;
}

.fw-pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.fw-pill {
    padding: 0.2rem 0.65rem;
    border-radius: 100px;
    font-size: var(--font-sm);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    border: 1.5px solid;
    line-height: 1.5;
}

.fw-pill--on {
    background: rgba(0, 92, 153, 0.07);
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
    font-weight: 500;
}

.fw-pill--on:hover {
    background: rgba(0, 92, 153, 0.14);
}

.fw-pill--off {
    background: transparent;
    border-color: #ddd;
    color: #bbb;
    text-decoration: line-through;
}

.fw-pill--off:hover {
    border-color: #bbb;
    color: #999;
}

.fw-count-row {
    margin-bottom: 1.1rem;
    padding: 0.45rem 0.75rem;
    background: #f8fafc;
    border-radius: 6px;
    text-align: center;
}

.fw-count-text {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
}

.fw-count-text strong {
    color: var(--color-univie-blue);
    font-weight: 600;
}

/* Disambiguation overlay */
.disambiguation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
    backdrop-filter: blur(2px);
}

.disambiguation-wrapper {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.disambiguation-box {
    background: white;
    border: 3px solid #FF8552;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.disambiguation-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: #C2410C;
    margin: 0 0 var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.disambiguation-title::before {
    content: "⚠";
    font-size: 1.25rem;
}

.disambiguation-progress {
    margin: 0 0 var(--spacing-xs);
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.disambiguation-query {
    margin: 0 0 var(--spacing-sm);
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    font-weight: 500;
}

.disambiguation-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-sm);
}

.disambiguation-candidate {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: left;
}

.disambiguation-candidate:hover {
    border-color: var(--color-univie-blue);
    background: #F0F8FC;
}

.disambiguation-name {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-univie-blue);
}

.disambiguation-field {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.disambiguation-skip-btn {
    margin-top: var(--spacing-xs);
    font-size: 0.8125rem;
}

/* ============================================
   Responsive — tablet / mobile (≤1024px)
   ============================================ */

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    /* Reduce hero container side padding to match container-fluid at this width */
    .hero-b-container {
        padding-left: var(--spacing-sm);
        padding-right: var(--spacing-sm);
    }

    .filter-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 310px;
        height: 100%;
        max-height: none;
        border-radius: 0;
        border: none;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
        z-index: 200;
        transition: left 0.3s ease;
    }

    .filter-sidebar.open {
        left: 0;
    }

    .mobile-filter-toggle {
        display: flex;
    }

    .footer {
        padding-bottom: 120px;
    }

}


@media (max-width: 640px) {
    .mobile-filter-toggle {
        padding: 0.65rem 1.1rem;
        gap: 0.5rem;
    }

    .filter-btn-title {
        font-size: var(--font-sm);
    }

    .filter-btn-hint {
        font-size: 0.7rem;
        max-width: 160px;
    }

    /* mobile-filter-toggle adjustments only — hero/card overrides are after their base rules */
}

@media (max-width: 768px) {
    .container,
    .container-fluid {
        padding: 0 var(--spacing-sm);
    }

    .hero-title {
        font-size: var(--font-2xl);
    }

    .hero-subtitle {
        font-size: var(--font-base);
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Stack results controls vertically on mobile */
    .results-controls {
        flex-direction: column;
        align-items: stretch;
        gap: var(--spacing-xs);
        width: 100%;
    }

    .sort-control {
        width: 100%;
    }

    .sort-custom {
        flex: 1;
    }

    .sort-btn {
        width: 100%;
        justify-content: flex-start;
    }

    .sort-btn .sort-btn-chevron {
        margin-left: auto;
    }

    .sort-panel {
        width: 100%;
    }

    .view-toggle {
        width: 100%;
        justify-content: center;
    }

    .profile-cards {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        width: 100%;
        max-width: 100%;
    }

    .prompt-modal {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: var(--spacing-md) var(--spacing-md) 0;
    }

    .modal-body {
        padding: var(--spacing-md);
    }

    .modal-close-btn {
        top: 0.75rem;
        right: 0.75rem;
    }

    .toast-container {
        top: 1rem;
        right: 1rem;
        left: 1rem;
    }

    .toast {
        min-width: auto;
        width: 100%;
    }
}

/* =============================================================================
   TOOLTIP COMPONENT (Reusable)
   ============================================================================= */

/* Old .info-icon replaced by .info-icon-tooltip */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #cbd5e0;
    color: #2c3e50;
    font-size: 12px;
    font-weight: 600;
    cursor: help;
    margin-left: 6px;
    vertical-align: middle;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.info-icon:hover,
.info-icon:focus {
    background: #3498db;
    color: white;
    outline: none;
}

.info-icon:focus-visible {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
}

/* Tooltip popover */
.tooltip-popover {
    position: absolute;
    z-index: 10001;
    background: #2c3e50;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tooltip-popover.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Tooltip arrow */
.tooltip-popover::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #2c3e50;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .info-icon,
    .tooltip-popover {
        transition: none;
    }
}

/* Show more/less toggle for filters */
.filter-show-more-container {
    padding: 8px 0;
    text-align: center;
}

.filter-show-more-btn {
    background: none;
    border: none;
    color: #3498db;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.filter-show-more-btn:hover {
    background: #ecf0f1;
    color: #2980b9;
}

.filter-show-more-btn:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Hide categories beyond limit */
.filter-category.hidden-category {
    display: none;
}

/* =============================================================================
   MODAL: REQUEST TYPE SELECTOR & PROFILE INFO
   ============================================================================= */

/* Compact Profile Count Line */
.modal-profile-info {
    margin-bottom: 1rem;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
}

.profile-count-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.profile-count-text {
    font-size: 13px;
    color: #2c3e50;
}

.profile-count-text strong {
    font-weight: 600;
}

/* Info icon tooltip */
.info-icon-tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #cbd5e0;
    color: #2c3e50;
    font-size: 11px;
    font-weight: 700;
    cursor: help;
    position: relative;
    flex-shrink: 0;
}

.info-icon-tooltip:hover {
    background: #3498db;
    color: white;
}

.info-icon-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: #2c3e50;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: 280px;
    max-width: 90vw;
    text-align: left;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.info-icon-tooltip:hover::after {
    opacity: 1;
}

/* Active filters section */
.modal-active-filters {
    min-height: 20px;
}

.modal-filters-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.modal-filter-note {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

/* ============================================
   Exclude People Panel
   ============================================ */

.exclude-panel {
    margin-top: 0.5rem;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.exclude-toggle-btn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: var(--color-surface);
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    text-align: left;
    transition: background 0.15s ease;
}

.exclude-toggle-btn:hover {
    background: #eef2f5;
    color: var(--color-text);
}

.exclude-toggle-btn[aria-expanded="true"] {
    background: #eef2f5;
    border-bottom: 1px solid var(--color-border-light);
}

.exclude-toggle-label {
    flex: 1;
}

.exclude-chevron {
    flex-shrink: 0;
    color: var(--color-text-secondary);
    transition: transform 0.2s ease;
}

.exclude-toggle-btn[aria-expanded="true"] .exclude-chevron {
    transform: rotate(180deg);
}

.exclude-list-wrapper {
    background: white;
}

.exclude-list {
    max-height: 190px;
    overflow-y: auto;
    padding: 0.2rem 0;
}

.exclude-list::-webkit-scrollbar {
    width: 6px;
}

.exclude-list::-webkit-scrollbar-track {
    background: transparent;
}

.exclude-list::-webkit-scrollbar-thumb {
    background: var(--color-border-light);
    border-radius: 3px;
}

.exclude-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.28rem 0.75rem;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1.35;
    transition: background 0.1s ease;
    user-select: none;
}

.exclude-item:hover {
    background: var(--color-surface);
}

.exclude-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 13px;
    height: 13px;
    accent-color: var(--color-univie-blue);
    cursor: pointer;
}

.exclude-item-name {
    color: var(--color-text);
    transition: color 0.15s ease;
}

.exclude-item input[type="checkbox"]:not(:checked) ~ .exclude-item-name {
    color: #adb5bd;
    text-decoration: line-through;
    text-decoration-color: #ced4da;
}

/* Profile Info Tooltip */
.profile-info-tooltip {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    margin-top: 8px;
}

.profile-info-tooltip.hidden {
    display: none;
}

.tooltip-tip {
    margin: 0 0 12px 0;
    font-size: 13px;
    line-height: 1.5;
    color: #5a6c7d;
}

.tooltip-filters h5 {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 8px 0;
}

/* Modal filter chips */
.modal-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 500;
    color: #495057;
    transition: all 0.15s ease;
    user-select: none;
}

/* Both the legacy class and the JS-generated class get the active (blue) style */
.modal-filter-chip-clickable,
.modal-filter-chip.modal-filter-clickable {
    cursor: pointer;
    background: #e7f3ff;
    border-color: #90c9ff;
    color: #0066cc;
}

.modal-filter-chip-clickable:hover,
.modal-filter-chip.modal-filter-clickable:hover {
    background: #cce5ff;
    border-color: #66b3ff;
    color: #0052a3;
}

/* Deactivated filter chip: grayed out, strikethrough, still clickable */
.modal-filter-chip.modal-filter-deactivated {
    background: #f1f3f5;
    border-color: #dee2e6;
    color: #adb5bd;
    text-decoration: line-through;
    text-decoration-color: #ced4da;
    cursor: pointer;
}

.modal-filter-chip.modal-filter-deactivated:hover {
    background: #e9ecef;
    border-color: #ced4da;
    color: #6c757d;
    text-decoration: none;
}

.modal-filter-chip.modal-filter-ai {
    background: #FFF4E6;
    color: #D97706;
    border: 1px solid #FED7AA;
    font-weight: 600;
    cursor: default;
}

/* Request Type Selector (Pill Button Style) */
.request-type-selector {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin: 0 0 1rem 0;
}

.request-type-selector legend {
    float: left;
    width: 100%;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 10px;
    padding: 0;
}

.request-type-selector .request-type-options {
    clear: left;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Generic section box — matches .ai-model-selector / .strictness-slider-wrap */
.modal-section-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 1rem;
}

.modal-section-box .form-group {
    margin-bottom: 0;
}

.request-type-option {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.85rem;
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    user-select: none;
    background: white;
}

.request-type-option:hover {
    border-color: var(--color-accent);
}

.request-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.request-type-option:has(input:checked) {
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 8%, transparent);
    color: var(--color-accent);
    font-weight: 500;
}

.request-type-option:focus-within {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* =============================================================================
   ACCESSIBILITY & FOCUS STATES
   ============================================================================= */

/* Enhanced focus states for better keyboard navigation */
button:focus-visible,
.btn:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible,
select:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Ensure sufficient color contrast */
.filter-helper-text,
.progress-subtitle {
    color: #5a6c7d; /* Improved contrast from original */
}

/* AI Orange consistency - only for AI-related elements */
.card-ai-badge {
    background: #FFF4E6;
    color: #D97706;
    border-left: 3px solid #D97706;
}

.btn-ai-fast:focus-visible {
    outline-color: #10a37f;
}

.btn-ai-thorough:focus-visible {
    outline-color: #6366f1;
}

/* Reduced motion support for all animations */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .tooltip-popover,
    .info-icon,
    .progress-spinner,
    .progress-fill {
        animation: none !important;
        transition: none !important;
    }
}

/* Improved visual hierarchy */
.filter-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.filter-group {
    margin-bottom: 24px; /* Increased spacing */
}

/* Skip to content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #3498db;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* =============================================================================
   AI ANALYSIS STYLES
   ============================================================================= */

/* AI Analysis Section */
.ai-analysis-section {
    margin-top: 0;
}

.ai-analysis-section > .btn {
    margin-top: 1rem;
}

/* AI Model Selector */
.ai-model-selector {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 12px;
}

.ai-model-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.ai-model-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-model-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: white;
}

.ai-model-option:hover {
    border-color: var(--color-univie-blue);
    background: #F8F9FA;
}

.ai-model-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--color-univie-blue);
}

.ai-model-option input[type="radio"]:checked + .model-name {
    font-weight: 600;
    color: var(--color-univie-blue);
}

.ai-model-option:has(input:checked) {
    border-color: var(--color-univie-blue);
    background: #EFF6FF;
}

.model-name {
    flex: 1;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-primary);
}

.model-provider {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    font-weight: 400;
}

.model-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.model-badge--recommended {
    background: #E8F5E9;
    color: #2E7D32;
}

.model-badge--cost {
    background: #FFF3E0;
    color: #E65100;
}

/* ==========================================
   STRICTNESS SLIDER
   ========================================== */

.strictness-slider-wrap {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 14px 10px;
    margin-bottom: 12px;
}

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

.strictness-slider-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

/* Info button */
.strictness-info-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.strictness-info-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--color-text-secondary);
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, color 0.15s;
}

.strictness-info-btn:hover {
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
}

/* Tooltip */
.strictness-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: #1a2a3a;
    color: #f0f4f8;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.5;
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.strictness-tooltip p {
    margin: 0 0 8px;
}

.strictness-tooltip p:last-child {
    margin-bottom: 0;
}

.strictness-tooltip strong {
    color: #ffffff;
}

.strictness-info-wrap:hover .strictness-tooltip {
    display: block;
}

/* Hero-b info tooltips: align to left of button (extends rightward) */
.hero-b-info-wrap .strictness-tooltip {
    right: auto;
    left: 0;
}

/* Opens downward (for items near the top of the panel) */
.hero-b-info-wrap.opens-down .strictness-tooltip {
    bottom: auto;
    top: calc(100% + 8px);
}

.strictness-track-container {
    position: relative;
    padding: 4px 0;
}

.strictness-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
    background: linear-gradient(
        to right,
        var(--color-univie-blue) 0%,
        var(--color-univie-blue) var(--slider-fill, 50%),
        var(--color-border) var(--slider-fill, 50%),
        var(--color-border) 100%
    );
}

.strictness-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2.5px solid var(--color-univie-blue);
    box-shadow: 0 1px 4px rgba(0, 92, 153, 0.2);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.strictness-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 92, 153, 0.35);
}

.strictness-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2.5px solid var(--color-univie-blue);
    box-shadow: 0 1px 4px rgba(0, 92, 153, 0.2);
    cursor: pointer;
    border: none;
}

.strictness-slider::-moz-range-track {
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
}

.strictness-slider::-moz-range-progress {
    height: 4px;
    background: var(--color-univie-blue);
    border-radius: 2px;
}

.strictness-labels {
    display: flex;
    margin-top: 10px;
}

.strictness-option {
    flex: 1;
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color 0.15s;
    user-select: none;
}

.strictness-option[data-value="0"] { text-align: left; }
.strictness-option[data-value="1"] { text-align: center; }
.strictness-option[data-value="2"] { text-align: right; }

.strictness-option.active {
    color: var(--color-univie-blue);
    font-weight: 600;
}

/* AI Model Selector inline removed - using box version */

/* Strictness slider tick marks */
.strictness-ticks {
    display: flex;
    justify-content: space-between;
    padding: 0 10px; /* align with thumb travel range (thumb is 20px wide, so 10px each side) */
    margin-top: 3px;
}
.strictness-ticks span {
    width: 1.5px;
    height: 5px;
    background: var(--color-text-secondary);
    opacity: 0.35;
    border-radius: 1px;
}

/* AI field badge in edit form */
.ai-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #D97706;
    background: #FFF4E6;
    border: 1px solid var(--color-accent-orange);
    border-radius: 3px;
    padding: 0px 5px;
    vertical-align: text-bottom;
    margin-left: 4px;
    line-height: 1.6;
}

/* Email lock in edit form */
.email-lock-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}
.email-lock-wrapper .edit-input {
    flex: 1;
}
.email-lock-wrapper .edit-input[readonly] {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: default;
}
.email-unlock-btn {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    font-size: var(--font-sm);
    font-weight: 500;
    font-family: inherit;
    color: var(--color-univie-blue);
    background: transparent;
    border: 1.5px solid var(--color-univie-blue);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.email-unlock-btn:hover {
    background: var(--color-univie-blue);
    color: white;
}
.email-cancel-btn {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    font-size: var(--font-sm);
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text-secondary);
    background: transparent;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.email-cancel-btn:hover {
    border-color: var(--color-text-secondary);
    color: var(--color-text-primary);
}

/* First + last name side-by-side layout in edit form */
.edit-fields-name {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
}
.email-unlock-warning {
    margin: 0.5rem 0 0;
    padding: 0.5rem 0.75rem;
    font-size: var(--font-sm);
    color: #92400E;
    background: #FFF8E1;
    border: 1px solid #F59E0B;
    border-radius: var(--radius-sm);
    line-height: 1.5;
}

/* Opportunities badge */
.opportunities-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    box-sizing: border-box;
    background: var(--color-univie-blue);
    color: white;
    font-size: 12px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    border-radius: 11px;
    vertical-align: 0.1em;
    margin-left: 7px;
}

/* AI Analysis Button Container */
.ai-analysis-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

/* AI Analysis Button Base Styles */
.btn-ai-fast,
.btn-ai-thorough {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-weight: 600;
}

/* Fast Analysis Button */
.btn-ai-fast {
    background: linear-gradient(135deg, #10a37f 0%, #0d8a6b 100%);
}

.btn-ai-fast:hover {
    background: linear-gradient(135deg, #0d8a6b 0%, #0a7059 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
}

/* Thorough Analysis Button */
.btn-ai-thorough {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
}

.btn-ai-thorough:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Button Text Container */
.btn-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: left;
}

.btn-title {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}

.btn-subtitle {
    font-size: 11px;
    opacity: 0.85;
    font-weight: 400;
    line-height: 1.2;
}

/* Legacy AI Button Support (keeping for backward compatibility) */
.btn-ai {
    background: linear-gradient(135deg, #10a37f 0%, #0d8a6b 100%);
    color: white;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    border: none;
    transition: all 0.3s ease;
}

.btn-ai:hover {
    background: linear-gradient(135deg, #0d8a6b 0%, #0a7059 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
}

.btn-ai .btn-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff6b6b;
    color: white;
    font-size: 0.625rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    border: 2px solid white;
}

/* Progress Overlay */
.ai-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.ai-progress-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.ai-progress-box h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #2c3e50;
}

.progress-subtitle {
    color: #7f8c8d;
    margin-bottom: 24px;
    font-size: 14px;
}

/* Progress Bar */
.ai-analysis-progress {
    margin: 24px 0;
}

.progress-label-container {
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    color: #34495e;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: baseline;
}

.progress-label-text {
    /* Text stays centered */
}

.progress-label-dots {
    display: inline-block;
    width: 1.5em;
    text-align: left;
    /* Fixed width so text doesn't shift */
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: #ecf0f1;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #D97706 0%, #F59E0B 100%);
    border-radius: 6px;
    transition: width 0.3s ease-out;
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.3);
    position: relative;
}

@media (prefers-reduced-motion: no-preference) {
    /* Subtle shimmer effect */
    .progress-bar-fill::after {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
        animation: shimmer 2s infinite;
    }

    @keyframes shimmer {
        0% {
            left: -100%;
        }
        100% {
            left: 100%;
        }
    }
}

.progress-percentage {
    font-size: 13px;
    font-weight: 600;
    color: #D97706;
    text-align: center;
}

/* Professional Progress Spinner */
.progress-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    border: 3px solid #e0e0e0;
    border-top-color: #D97706; /* AI orange accent */
    border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
    .progress-spinner {
        animation: spin 1.2s linear infinite;
    }

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

/* Research Insights Carousel — shown during AI analysis loading */
.progress-insights {
    margin-top: 24px;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
}

.insights-header {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748B;
    margin: 0 0 10px 0;
    text-align: center;
}

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

.insight-cards {
    flex: 1;
    display: grid;
}

.insight-card {
    grid-area: 1 / 1;
    padding: 14px 18px;
    background: #F8F9FB;
    border: 1px solid #DDE1E7;
    border-radius: 8px;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.insight-card--active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.insight-text {
    margin: 0 0 10px 0;
    font-size: 13px;
    line-height: 1.65;
    color: #1E293B;
    text-align: left;
}

.insight-attribution {
    margin: 0;
    font-size: 11.5px;
    color: #64748B;
    font-style: italic;
    text-align: right;
}

.insight-nav {
    flex-shrink: 0;
    background: none;
    border: 1.5px solid #DDE1E7;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 18px;
    line-height: 1;
    color: #64748B;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    padding: 0;
}

.insight-nav:hover {
    background: #F1F3F6;
    border-color: #94A3B8;
}

.insight-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.insight-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: none;
    background: #CBD5E1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

.insight-dot--active {
    background: #475569;
}

/* Progress actions (cancel button) */
.progress-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.progress-cancel-btn {
    padding: 8px 20px;
    background: transparent;
    border: 2px solid #95a5a6;
    color: #7f8c8d;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.progress-cancel-btn:hover {
    background: #ecf0f1;
    border-color: #7f8c8d;
    color: #2c3e50;
}

.progress-cancel-btn:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Error state for progress overlay */
.progress-error {
    margin-top: 20px;
    padding: 16px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: #c33;
}

.progress-error-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.progress-error-message {
    font-size: 13px;
    line-height: 1.5;
}

.progress-error-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Overlay full-replacement error state */
.overlay-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 0 4px;
}

.overlay-error-icon {
    color: #c0392b;
    margin-bottom: 16px;
}

.overlay-error-title {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 10px;
}

.overlay-error-message {
    font-size: 15px;
    color: #555;
    max-width: 380px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.overlay-error-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-error-retry {
    padding: 8px 16px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-error-retry:hover {
    background: #c0392b;
}

.btn-error-close {
    padding: 8px 16px;
    background: transparent;
    border: 2px solid #95a5a6;
    color: #7f8c8d;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-error-close:hover {
    background: #ecf0f1;
    border-color: #7f8c8d;
}



/* ============================================
   Edit Profile Request Modal (in index.html)
   ============================================ */

.edit-request-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 33, 56, 0.45);
    z-index: 2000;
}

.edit-request-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2001;
    background: var(--color-background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}

.edit-request-modal h3 {
    font-family: var(--font-sans);
    font-size: var(--font-xl);
    color: var(--color-text-primary);
    margin: 0 0 0.5rem 0;
}

.edit-request-desc {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: 0 0 1.25rem 0;
    line-height: 1.5;
}

.edit-request-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 0.4rem;
}

.edit-request-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    background: var(--color-background);
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.edit-request-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 92, 153, 0.12);
}

.edit-request-error {
    font-size: var(--font-xs);
    color: var(--color-error);
    margin-top: 0.35rem;
}

.edit-request-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.edit-request-success-icon {
    color: var(--color-success);
    margin-bottom: 1rem;
}

.edit-request-success-icon svg {
    display: block;
}

/* ============================================
   Suggest Funding Call
   ============================================ */

.hero-b-calls-actions-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.suggest-call-btn {
    background: none;
    border: none;
    padding: 0.3rem 0;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: color 0.15s, text-decoration-color 0.15s;
}

.suggest-call-btn:hover {
    color: var(--color-accent);
    text-decoration-color: var(--color-accent);
}

.suggest-call-modal {
    max-width: 480px;
    overflow-y: auto;
    max-height: 90vh;
}

.suggest-call-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin-top: 0.4rem;
}

.suggest-call-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

.suggest-call-preview {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.suggest-call-preview-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.suggest-call-domain {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-text-secondary);
    font-size: 0.75rem;
}

/* ============================================
   Feedback Bar
   ============================================ */

.feedback-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-background);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    z-index: 500;
    padding: 1.25rem 1rem;
    animation: feedbackFadeIn 0.18s ease-out;
}

.feedback-bar.feedback-bar-exit {
    animation: feedbackFadeOut 0.15s ease-in forwards;
}

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

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

.feedback-bar.hidden {
    display: none;
}

.feedback-bar-content {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.feedback-bar-main {
    flex: 1;
    min-width: 300px;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.feedback-bar-question-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
}

.feedback-bar-question {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.4;
}

.feedback-bar-helper {
    font-size: 0.75rem;
    color: #999999;
    font-style: italic;
    opacity: 0.85;
}

.feedback-bar-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.feedback-btn {
    padding: 0.45rem 1rem;
    border: 1px solid #ddd;
    background: #f3f4f6;
    color: #333;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.12s ease;
}

.feedback-btn-yes:hover {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.15);
}

.feedback-btn-no:hover {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.15);
}

.feedback-btn-dismiss {
    padding: 0.35rem 0.5rem;
    border: none;
    background: none;
    color: var(--color-text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.15s;
    margin-left: auto;
    flex-shrink: 0;
}

.feedback-btn-dismiss:hover {
    color: var(--color-text-primary);
}

.feedback-reasons {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    animation: fadeIn 0.2s ease-out;
}

.feedback-reasons.hidden {
    display: none;
}

.feedback-reasons-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.35rem;
}

.feedback-reasons-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.feedback-reason-btn {
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.feedback-reason-btn:hover {
    background: var(--color-border);
    border-color: var(--color-text-secondary);
}

.feedback-reason-btn.selected {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

/* Feedback acknowledgement message (shown after submission) */
.feedback-ack {
    font-size: 1rem;
    color: var(--color-text-primary);
    text-align: center;
    padding: 0.75rem 0;
    animation: fadeIn 0.15s ease-out;
    font-weight: 500;
    letter-spacing: -0.01em;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.feedback-ack-fadeout {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Mobile adjustments */
@media (max-width: 640px) {
    .feedback-bar {
        padding: 0.75rem;
    }

    .feedback-bar-content {
        gap: 0.75rem;
    }

    .feedback-bar-main {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }

    .feedback-bar-question-wrapper {
        width: 100%;
    }

    .feedback-bar-buttons {
        width: 100%;
    }

    .feedback-btn-dismiss {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
        margin-left: 0;
    }
}

/* ============================================
   Edit Page (edit.html)
   ============================================ */

body.edit-page {
    font-family: var(--font-sans);
    color: var(--color-text-primary);
    background: var(--color-surface);
    min-height: 100vh;
}

/* Header */
.edit-header {
    background: var(--color-background);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.edit-header-inner {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.edit-back-link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    text-decoration: none;
    flex-shrink: 0;
    transition: color 0.15s;
}

.edit-back-link:hover { color: var(--color-accent); }

.edit-header-title {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.edit-header-label {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.edit-header-title h1 {
    font-family: var(--font-sans);
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0;
}

/* Main layout */
.edit-main {
    padding: 2rem 1.5rem 4rem;
}

.edit-container {
    max-width: 760px;
    margin: 0 auto;
}

/* State panels (loading / error / success) */
.edit-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
}

.edit-state-text {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    max-width: 360px;
    line-height: 1.6;
}

.edit-state-heading {
    font-family: var(--font-sans);
    font-size: var(--font-xl);
    color: var(--color-text-primary);
    margin: 0.5rem 0 0.25rem;
}

.edit-state-icon--success { color: var(--color-success); margin-bottom: 0.5rem; }
.edit-state-icon--error   { color: var(--color-error);   margin-bottom: 0.5rem; }

/* Spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.edit-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

/* Profile banner */
.edit-profile-banner {
    background: var(--color-univie-blue);
    color: #fff;
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.edit-profile-name {
    font-family: var(--font-sans);
    font-size: var(--font-xl);
    font-weight: 600;
}

.edit-profile-id {
    font-size: var(--font-xs);
    opacity: 0.7;
    font-family: monospace;
}

/* Intro text */
/* Draft restore banner */
.draft-banner {
    background: #FFF8E1;
    border: 1px solid #F9A825;
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
}
.draft-banner-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.draft-banner-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-sm);
    color: #5D4037;
}
.draft-banner-content svg { flex-shrink: 0; color: #F9A825; }
.draft-banner-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.draft-diff-panel {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #F9A825;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.draft-diff-row {
    display: grid;
    grid-template-columns: 8rem 1fr auto 1fr;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.8125rem;
    color: #5D4037;
}
.draft-diff-label {
    font-weight: 600;
    color: #4E342E;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.draft-diff-old {
    text-decoration: line-through;
    color: #9E9E9E;
    word-break: break-word;
}
.draft-diff-arrow {
    flex-shrink: 0;
    color: #F9A825;
    opacity: 0.8;
}
.draft-diff-new {
    color: #2E7D32;
    font-weight: 500;
    word-break: break-word;
}
@media (max-width: 600px) {
    .draft-diff-row {
        grid-template-columns: 1fr;
        gap: 0.15rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid #FDE082;
    }
    .draft-diff-row:last-child { border-bottom: none; }
    .draft-diff-arrow { display: none; }
}

.edit-intro {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0 0 2rem 0;
}

.edit-intro strong { color: var(--color-text-primary); }


/* Methods Picker */
.methods-picker {
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-background);
    overflow: hidden;
}

.methods-selected-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.625rem 0.75rem 0;
}
.methods-selected-pills:empty {
    padding: 0;
}
.method-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #E8F0F8;
    color: var(--color-univie-blue);
    border: 1px solid #BFDBFE;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem 0.5rem 0.2rem 0.625rem;
    line-height: 1.4;
}
.method-pill-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-univie-blue);
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
    opacity: 0.6;
    transition: opacity 0.15s;
}
.method-pill-remove:hover {
    opacity: 1;
}

.methods-search-wrapper {
    padding: 0.5rem;
    border-bottom: 1px solid var(--color-border-light);
    background: var(--color-surface);
}

.methods-search {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    background: var(--color-background);
    box-sizing: border-box;
}

.methods-search:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 92, 153, 0.12);
}

.methods-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.methods-category {
    margin-bottom: 0.25rem;
}

.methods-category-label {
    display: block;
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0.75rem 0.2rem;
}

.methods-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

.methods-item:hover { background: var(--color-surface); }

.methods-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--color-accent);
    flex-shrink: 0;
    cursor: pointer;
}

.methods-item--hidden { display: none; }

.methods-empty {
    padding: 1rem 0.75rem;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: 0;
}

.methods-add-new {
    border-top: 1px solid var(--color-border-light);
    padding: 0.6rem 0.75rem;
    background: var(--color-surface);
}

.methods-add-row {
    display: flex;
    gap: 0.5rem;
}

.methods-new-input {
    flex: 1;
    padding: 0.45rem 0.65rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    background: var(--color-background);
    min-width: 0;
}

.methods-new-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 92, 153, 0.12);
}

.methods-new-feedback {
    margin: 0.35rem 0 0;
    font-size: var(--font-xs);
    line-height: 1.4;
}

.methods-new-feedback--error { color: var(--color-error); }
.methods-new-feedback--warn  { color: #B45309; }

/* Form sections */
.edit-section {
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

/* Photo upload section */
.photo-upload-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.25rem 1.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 1.75rem;
}
.photo-upload-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--color-univie-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 600;
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: opacity 0.15s;
    user-select: none;
}
.photo-upload-avatar:hover { opacity: 0.88; }
.photo-upload-avatar.has-photo { cursor: grab; }
.photo-upload-avatar.has-photo:active { cursor: grabbing; }
.photo-upload-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    border-radius: 50%;
}
.photo-upload-avatar:hover .photo-upload-overlay { opacity: 1; }
.photo-upload-info { flex: 1; min-width: 0; }
.photo-upload-label {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 0.2rem 0;
}
.photo-upload-hint {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: 0 0 0.75rem 0;
}
.photo-upload-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.photo-upload-formats {
    font-size: 0.72rem;
    color: #999;
    margin: 0.4rem 0 0 0;
}
.photo-upload-error {
    font-size: var(--font-sm);
    color: var(--color-error);
    margin: 0.4rem 0 0 0;
}

/* Crop editor modal */
.crop-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(2px);
}
.crop-modal.hidden { display: none; }
.crop-modal-inner {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem 2rem 1.75rem;
    max-width: 360px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.crop-modal-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 0.3rem 0;
}
.crop-modal-hint {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: 0 0 1.25rem 0;
}
.crop-viewport {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 1.25rem;
    cursor: grab;
    user-select: none;
    background: var(--color-border);
    border: 3px solid var(--color-border);
    box-shadow: 0 0 0 4px var(--color-surface);
}
.crop-viewport:active { cursor: grabbing; }
#crop-canvas { display: block; width: 260px; height: 260px; }
.crop-zoom-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    color: var(--color-text-secondary);
}
.crop-zoom-row svg:first-child { flex-shrink: 0; }
.crop-zoom-row svg:last-child  { flex-shrink: 0; }
.crop-zoom-row input[type="range"] {
    flex: 1;
    accent-color: var(--color-univie-blue);
    height: 4px;
    cursor: pointer;
}
.crop-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.edit-section-title {
    font-family: var(--font-sans);
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1.25rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border-light);
}

.edit-section-ai-label {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
    color: #D97706;
    background: #FFF4E6;
    border: 1px solid #D97706;
    border-radius: 3px;
    padding: 1px 6px;
    margin-left: 0.5rem;
    vertical-align: middle;
    cursor: help;
    position: relative;
}

.edit-section-ai-label::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a2332;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1.45;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: normal;
    width: 260px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.edit-section-ai-label:hover::after {
    opacity: 1;
}

/* Edit page info cards (privacy, visibility, tips) */
.edit-info-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.edit-info-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    background: #f8fafb;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--color-text-secondary);
}

.edit-info-card strong {
    color: var(--color-text-primary);
    margin-right: 0.25rem;
}

.edit-info-card p {
    margin: 0;
}

.edit-info-card__icon {
    flex-shrink: 0;
    color: var(--color-primary);
    margin-top: 0.15rem;
    width: 16px;
    height: 16px;
}

.edit-section-note {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    margin: -0.75rem 0 1rem 0;
}

.edit-section-desc {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: -0.5rem 0 1.25rem 0;
    line-height: 1.5;
}

/* Representative Papers picker */
.papers-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.paper-entry {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.paper-entry-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.paper-entry-num {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.paper-doi-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.paper-doi-group .edit-input {
    flex: 1;
    min-width: 0;
}

.paper-lookup-status {
    font-size: var(--font-xs);
    min-height: 1.2rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.paper-lookup-status--ok    { color: #16a34a; }
.paper-lookup-status--error { color: #dc2626; }

.paper-manual-group {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.paper-meta-row {
    display: flex;
    gap: 0.5rem;
}

.paper-meta-row .paper-journal-input {
    flex: 1;
    min-width: 0;
}

.paper-meta-row .paper-year-input {
    width: 5.5rem;
    flex-shrink: 0;
}

.papers-add-btn {
    margin-top: 0.25rem;
}

.paper-note-input {
    margin-top: 0.5rem;
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
}

/* Fields grid */
.edit-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
}

.edit-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    grid-column: 1 / -1;
}

.edit-field.edit-field--half {
    grid-column: span 1;
}

.edit-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-primary);
}

.edit-label abbr {
    color: var(--color-accent);
    text-decoration: none;
    margin-left: 2px;
    cursor: help;
}

.edit-field-note {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    font-weight: 400;
}

.edit-input,
.edit-textarea {
    font-family: var(--font-sans);
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    background: var(--color-background);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.75rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    width: 100%;
    box-sizing: border-box;
}

.edit-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.edit-input:focus,
.edit-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(0, 92, 153, 0.12);
}

/* Split layout: left column (stacked fields) + right column (position picker) */
.edit-fields-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem 1.25rem;
    align-items: start;
    grid-column: 1 / -1;
}

.edit-fields-split__left {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.edit-fields-split__right {
}

.position-picker {
    /* no outer box — items are styled as pills */
}

.position-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.1rem 0;
}

.position-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.position-item:hover { border-color: var(--color-accent); }

.position-item:has(input:checked) {
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 8%, transparent);
    color: var(--color-accent);
    font-weight: 500;
}

.position-item--none {
    color: var(--color-text-secondary);
    border-color: #d1d5db;
    margin-top: 0.25rem;
}

.position-item--none:hover { border-color: #9ca3af; }

.position-item--none:has(input:checked) {
    border-color: #9ca3af;
    background: #f3f4f6;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.position-item input[type="radio"] {
    width: 15px;
    height: 15px;
    accent-color: var(--color-accent);
    flex-shrink: 0;
    cursor: pointer;
}

/* Institution Picker */
.institution-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.institution-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.institution-preset-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.institution-preset-item:hover { border-color: var(--color-accent); }

.institution-preset-item:has(input:checked) {
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 8%, transparent);
    color: var(--color-accent);
    font-weight: 500;
}

.institution-preset-item input[type="radio"] {
    accent-color: var(--color-accent);
    cursor: pointer;
}

/* Select (Faculty, etc.) */
.edit-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    cursor: pointer;
}

/* Approach Other text input */
.approach-other-wrap {
    width: 100%;
    margin-top: 0.25rem;
}

.approach-other-input {
    width: 100%;
    max-width: 340px;
}

/* Community Insight Tool Card */
.community-insight-card {
    background: #F0F6FF;
    border: 1.5px dashed #A0BFDF;
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-top: 0.25rem;
}

.community-insight-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.community-insight-card__header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.community-insight-card__optional {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    font-style: italic;
}

.community-insight-card__tag {
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-univie-blue);
    background: color-mix(in srgb, var(--color-univie-blue) 10%, transparent);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.community-insight-card__desc {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: 0 0 1rem;
    line-height: 1.5;
}

/* [?] button wrapper — anchors the tooltip */
.insight-info-wrap {
    position: relative;
    flex-shrink: 0;
}

/* [?] info button */
.insight-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1.5px solid var(--color-border);
    background: white;
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    transition: border-color 0.15s, color 0.15s;
}

.insight-info-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* Info tooltip — opens downward from [?], right-aligned, shown on hover */
.insight-info-popover {
    display: none;
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 100;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    width: 22rem;
    max-width: calc(100vw - 1.5rem); /* prevent desktop overflow too */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.insight-info-wrap:hover .insight-info-popover {
    display: block;
}

/* Mobile: bottom sheet — escapes all parent constraints */
@media (max-width: 640px) {
    .insight-info-popover {
        position: fixed;
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 1rem 1rem 0 0;
        z-index: 9999;
        box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.18);
        padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
    }
}

.insight-info-popover p {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: 0 0 0.6rem;
    line-height: 1.5;
}

/* Mockup card inside popover */
.insight-info-mockup {
    background: #f8f9fa;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.insight-info-mockup__tag {
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-univie-blue);
    display: block;
    margin-bottom: 0.4rem;
}

.insight-info-mockup__text {
    font-size: var(--font-sm);
    color: var(--color-text);
    line-height: 1.5;
    margin: 0 0 0.4rem;
    font-style: italic;
}

.insight-info-mockup__attr {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    display: block;
}

/* Restore block (shown after AI generation) */
.insight-original {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: color-mix(in srgb, var(--color-accent) 5%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-accent) 20%, transparent);
    border-radius: var(--radius-sm);
}

.insight-original__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}

.insight-original__label {
    font-size: var(--font-xs);
    font-weight: 500;
    color: var(--color-text-secondary);
}

.insight-original__text {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    line-height: 1.55;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.insight-original__restore {
    background: none;
    border: none;
    color: var(--color-accent);
    font-size: var(--font-xs);
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    flex-shrink: 0;
}

.insight-original__restore:hover {
    color: #004A7A;
}

/* Insight action buttons */
.insight-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.75rem;
    flex-wrap: wrap;
}

/* Research Approach Picker */
.approach-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.25rem 0;
}

.approach-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}

.approach-item:hover { border-color: var(--color-accent); }

.approach-item input[type="checkbox"] {
    accent-color: var(--color-accent);
    cursor: pointer;
}

.approach-item:has(input:checked) {
    border-color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 8%, transparent);
    color: var(--color-accent);
    font-weight: 500;
}

/* Edit field hint text */
.edit-field-hint {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: 0 0 0.5rem;
    line-height: 1.4;
}

/* Profile strength banner (top) */
.profile-strength {
    background: #f5f7fa;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
}
.profile-strength--ready {
    border-left-color: #27ae60;
    background: #f0faf4;
}
.profile-strength__header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}
.profile-strength__title {
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    font-weight: 500;
}
.profile-strength__label {
    font-size: var(--font-sm);
    font-weight: 600;
}
.profile-strength__track {
    height: 6px;
    background: #dde3ea;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.45rem;
}
.profile-strength__fill {
    height: 100%;
    border-radius: 3px;
    width: 0%;
    transition: width 0.4s ease, background-color 0.6s ease;
}
.profile-strength__impact {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    margin: 0;
    min-height: 1em;
}

/* Inline field strength ring (label-integrated) */
.field-strength-ring {
    flex-shrink: 0;
    display: block;
}
.field-strength-ring__fill {
    transform: rotate(-90deg);
    transform-origin: 10px 10px;
    transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
}
.field-strength-ring__check {
    transition: opacity 0.2s ease;
}
.field-strength__hint {
    display: block;
    font-size: 0.73rem;
    line-height: 1.3;
    margin-top: 0.2rem;
    color: var(--color-text-secondary);
}

/* Char counter */
.edit-field-footer {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.edit-charcount {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
}

.edit-charcount--warn {
    color: var(--color-accent-orange);
    font-weight: 500;
}

.edit-charcount--over {
    color: #c0392b;
    font-weight: 600;
}

.field-last-updated {
    font-size: 0.72rem;
    color: #bbb;
    font-style: italic;
}

/* Actions */
.edit-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    position: sticky;
    bottom: 1rem;
    box-shadow: var(--shadow-md);
}

.edit-save-status {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
}

.edit-save-status--error   { color: var(--color-error); }
.edit-save-status--success { color: var(--color-success); }

.edit-url-warning {
    margin-top: 0.4rem;
    padding: 0.55rem 0.8rem;
    border-left: 3px solid #d97706;
    background: #fffbeb;
    color: #78350f;
    font-size: var(--font-sm);
    border-radius: 0 4px 4px 0;
    line-height: 1.5;
}

.edit-url-warning--soft {
    border-left-color: #0284c7;
    background: #f0f9ff;
    color: #0c4a6e;
}

/* Inline strength indicator (inside save bar) */
.psf-inline {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.3s;
}

.psf-inline.psf-visible {
    opacity: 1;
}

.psf-inline .psf-ring {
    display: block;
    flex-shrink: 0;
}

.psf-ring__fill {
    transition: stroke-dashoffset 0.4s ease, stroke 0.3s;
}

.psf-inline .psf-label {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 600px) {
    .edit-fields {
        grid-template-columns: 1fr;
    }

    .edit-field.edit-field--half {
        grid-column: 1 / -1;
    }

    .edit-fields-split {
        grid-template-columns: 1fr;
    }

    .edit-fields-split__right {
        position: static;
    }

    .edit-header-inner {
        gap: 0.75rem;
    }

    .edit-header-title h1 {
        font-size: var(--font-base);
    }

    .edit-actions {
        position: static;
        flex-direction: column;
        align-items: flex-start;
    }

    .psf-inline {
        margin-left: 0;
        align-self: flex-start;
    }
}

/* ============================================
   Version B — Hero Search Interface
   ============================================ */

/* Version B hero: visible by default */
.hero-section-b {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-height: 52vh;
    background: linear-gradient(160deg, #f8fafc 0%, #eef4f9 100%);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0 3rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.hero-b-container {
    position: relative;
    max-width: 820px;
    width: 100%;
    text-align: center;
    padding: 0 var(--spacing-lg) 0;
}

.hero-b-matchmaking {
    display: block;
    font-family: var(--font-sans);
    font-size: var(--font-xl);
    font-weight: 420;
    color: var(--color-text-secondary);
    margin-top: 0.9rem;
    margin-bottom: 0.25rem;
}

.hero-b-brand {
    display: inline-block;
    font-size: var(--font-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-univie-blue);
    margin-top: 0.5rem;
    margin-bottom: 2rem;
}

.hero-b-title {
    font-family: var(--font-sans);
    font-size: 2.625rem;
    font-weight: 700;
    color: var(--color-text-primary);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 0;
}

.hero-b-subtitle {
    font-size: var(--font-lg);
    color: var(--color-text-secondary);
    margin-bottom: 2rem;
    line-height: 1.55;
}

.hero-b-search-box {
    background: white;
    border: 1.5px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 92, 153, 0.09), 0 1px 4px rgba(0,0,0,0.05);
    padding: 1.25rem 1.25rem 1.25rem;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
    text-align: left;
    max-width: 100%;
    box-sizing: border-box;
}

.hero-b-search-box:focus-within {
    border-color: var(--color-univie-blue);
    box-shadow: 0 6px 32px rgba(0, 92, 153, 0.15), 0 1px 4px rgba(0,0,0,0.05);
}

.hero-b-textarea {
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    font-family: var(--font-sans);
    font-size: var(--font-base);
    color: var(--color-text-primary);
    line-height: 1.65;
    background: transparent;
    min-height: 148px;
    height: 148px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 6px;
    margin-bottom: 0.5rem;
    transition: height 0.18s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: height;
    box-sizing: border-box;
}

.hero-b-textarea::placeholder {
    color: #b0b9c3;
}

.hero-b-search-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-top: 1px solid var(--color-border-light);
    padding-top: 0.75rem;
    gap: 0.75rem;
}

.hero-b-hint-inline {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    line-height: 1.4;
}

.hero-b-hint-inline kbd {
    display: inline-block;
    padding: 0.05em 0.35em;
    font-family: var(--font-sans);
    font-size: 0.7rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    color: var(--color-text-secondary);
}

.hero-b-btn {
    background: var(--color-univie-blue);
    color: white;
    border: none;
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-sm);
    cursor: pointer;
    font-family: var(--font-sans);
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.1s ease;
    flex-shrink: 0;
}

.hero-b-btn:hover {
    background: var(--color-univie-blue-dark);
}

.hero-b-btn:active {
    transform: scale(0.98);
}

.hero-b-footer-hint {
    margin-top: 1.25rem;
}

.hero-b-browse-btn {
    display: inline-block;
    padding: 0.45rem 1.2rem;
    border: 1.5px solid var(--color-univie-blue);
    border-radius: var(--radius-full, 999px);
    color: var(--color-univie-blue);
    font-size: var(--font-sm);
    font-weight: 500;
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
}

.hero-b-browse-btn:hover {
    background: var(--color-univie-blue);
    color: #fff;
}


/* ---- Inline options expansion ---- */

/* Hide footer (Find Researchers btn) when options are open */
.hero-b-search-box.options-open .hero-b-search-footer {
    display: none;
}

/* Options container — animates open/closed */
.hero-b-options {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.25s ease;
}

.hero-b-options.is-open {
    max-height: 1800px;
    opacity: 1;
}

.hero-b-opt-divider {
    border-top: 1px solid var(--color-border-light);
    margin: 0.75rem 0 1rem;
}

.hero-b-opt-row {
    margin-bottom: 1.1rem;
}

.hero-b-opt-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 0.45rem;
}

/* Label + info icon on same row */
.hero-b-opt-label-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.45rem;
}

.hero-b-opt-label-row .hero-b-opt-label {
    margin-bottom: 0;
}

/* Exclude toggle + info icon on same row */
.hero-b-exclude-header-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Inner textarea (for funding call description) — fixed height, scrollable */
.hero-b-inner-textarea {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.625rem;
    font-family: var(--font-sans);
    font-size: var(--font-sm);
    color: var(--color-text-primary);
    line-height: 1.55;
    resize: none;
    outline: none;
    background: var(--color-surface);
    transition: border-color 0.15s;
    margin-top: 0.4rem;
    height: calc(7 * 1.55em - 1rem);
    overflow-y: auto;
}

.hero-b-inner-textarea:focus {
    border-color: var(--color-univie-blue);
    background: white;
}

.hero-b-call-select {
    width: 100%;
    margin-bottom: 0;
}

.hero-b-call-select-hidden {
    display: none;
}

/* Call cards in funding row */
.hero-b-calls-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.hero-b-call-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 0.9rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.hero-b-call-card:hover {
    border-color: var(--color-univie-blue);
    box-shadow: 0 0 0 3px rgba(0,92,153,0.07);
}

.hero-b-call-card.is-selected {
    border-color: var(--color-univie-blue);
    background: #f0f6fb;
    box-shadow: 0 0 0 3px rgba(0,92,153,0.10);
}

.hero-b-call-card-body {
    flex: 1;
    min-width: 0;
}

.hero-b-call-card-title {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.2rem;
}

.hero-b-call-card-desc {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    line-height: 1.45;
    margin-bottom: 0.2rem;
}

.hero-b-call-card-meta {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.hero-b-call-card-actions {
    display: flex;
    flex-direction: row;
    gap: 0.35rem;
    flex-shrink: 0;
    align-items: center;
}

.hero-b-call-card-actions .btn {
    white-space: nowrap;
    text-align: center;
    text-decoration: none;
    font-size: 11px;
}

.hero-b-call-custom-section {
    margin-top: 0.25rem;
}

.hero-b-custom-label {
    display: block;
    margin-bottom: 0.4rem;
}

@media (max-width: 500px) {
    .hero-b-call-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .hero-b-call-card-actions {
        flex-direction: row;
        width: 100%;
    }
    .hero-b-call-card-actions .btn {
        flex: 1;
    }
}

/* Type chips — reused from old step2 */
.hero-b-type-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.hero-b-type-chip {
    padding: 0.35rem 0.8rem;
    border: 1.5px solid var(--color-border);
    border-radius: 99px;
    background: white;
    color: var(--color-text-secondary);
    font-size: var(--font-sm);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.hero-b-type-chip:hover {
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
}

.hero-b-type-chip.active {
    background: var(--color-univie-blue);
    border-color: var(--color-univie-blue);
    color: white;
    font-weight: 500;
}

.hero-b-chip-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    box-sizing: border-box;
    background: var(--color-univie-blue);
    color: white;
    font-size: 11px;
    font-weight: 700;
    border-radius: 9px;
    margin-left: 5px;
    vertical-align: 0.05em;
}

.hero-b-type-chip.active .hero-b-chip-badge {
    background: white;
    color: var(--color-univie-blue);
}

/* Selectivity slider */
.hero-b-slider-wrap {
    width: 100%;
}

.hero-b-slider-labels {
    display: flex;
    margin-top: 8px;
}

.hero-b-sl-opt {
    flex: 1;
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    user-select: none;
}

.hero-b-sl-opt:first-child { text-align: left; }
.hero-b-sl-opt:nth-child(2) { text-align: center; }
.hero-b-sl-opt:last-child { text-align: right; }

.hero-b-sl-opt.active {
    color: var(--color-univie-blue);
    font-weight: 600;
}

/* Scope count + filters toggle row */
.hero-b-scope-count-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

/* Scope count display */
.hero-b-scope-count {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
}

.hero-b-scope-count strong {
    color: var(--color-univie-blue);
    font-weight: 600;
}

/* Filters toggle button — hidden (filters always visible in advanced panel) */
.hero-b-filters-toggle {
    display: none !important;
}

.hero-b-filters-toggle-hidden {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: white;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.75rem 0.3rem 0.6rem;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.hero-b-filters-toggle:hover {
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
}

.hero-b-filters-toggle.active {
    background: rgba(0, 92, 153, 0.07);
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
}

.hero-b-filters-toggle svg {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.hero-b-filters-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Scope content wrapper */
.hero-b-scope-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Inline filter pickers — chip-based (collapsible) */
.hero-b-filter-picks {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-top: 0.5rem;
}

.hero-b-filter-picks.hidden {
    display: none;
}

.hero-b-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.hero-b-filter-group-label {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.hero-b-filter-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.hero-b-filter-chip-btn {
    padding: 0.25rem 0.7rem;
    border: 1.5px solid var(--color-border);
    border-radius: 99px;
    background: white;
    color: var(--color-text-secondary);
    font-size: 0.73rem;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.hero-b-filter-chip-btn:hover {
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
}

.hero-b-filter-chip-btn.active {
    background: var(--color-univie-blue);
    border-color: var(--color-univie-blue);
    color: white;
    font-weight: 500;
}

/* Sub-methods expansion panel */
.hero-b-submethods-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    transition: max-height 0.35s ease, opacity 0.22s ease, margin-top 0.22s ease;
}

.hero-b-submethods-panel.has-content {
    /* max-height and overflow set by JS for smooth exact-height animation */
    opacity: 1;
    margin-top: 0.45rem;
}

/* Sub-method chip — lighter blue when active */
.hero-b-submethod-chip {
    padding: 0.2rem 0.6rem;
    border: 1.5px solid var(--color-border);
    border-radius: 99px;
    background: white;
    color: var(--color-text-secondary);
    font-size: 0.68rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    line-height: 1.4;
}

.hero-b-submethod-chip:hover:not(.active) {
    border-color: #5a9ec8;
    color: #2f7ab3;
}

.hero-b-submethod-chip.active {
    background: #daeaf5;
    border-color: #5a9ec8;
    color: #005C99;
    font-weight: 500;
}

/* ---- Method category chip colors (9 categories + other) ---- */
/* Default: grey (neutral). Hover: subtle grey darkening. Active: category color. */

/* Category chips — grey by default, colored when active */
.hero-b-filter-chip-btn[data-color].active { color: #fff; }

.hero-b-filter-chip-btn[data-color="neuro"].active        { background: #C96080; border-color: #C96080; }
.hero-b-filter-chip-btn[data-color="brainstim"].active    { background: #BE6A48; border-color: #BE6A48; }
.hero-b-filter-chip-btn[data-color="eye"].active          { background: #7AA23E; border-color: #7AA23E; }
.hero-b-filter-chip-btn[data-color="behavioral"].active   { background: #429C5E; border-color: #429C5E; }
.hero-b-filter-chip-btn[data-color="selfreport"].active   { background: #329880; border-color: #329880; }
.hero-b-filter-chip-btn[data-color="computational"].active { background: #5C82BE; border-color: #5C82BE; }
.hero-b-filter-chip-btn[data-color="physiological"].active { background: #7A6EBA; border-color: #7A6EBA; }
.hero-b-filter-chip-btn[data-color="acoustic"].active     { background: #9858B4; border-color: #9858B4; }
.hero-b-filter-chip-btn[data-color="synthesis"].active    { background: #BA5688; border-color: #BA5688; }
.hero-b-filter-chip-btn[data-color="other"].active        { background: #9CA3AF; border-color: #9CA3AF; }

/* Sub-method chips — grey by default, colored when active */
.hero-b-submethod-chip[data-color].active { font-weight: 500; }

.hero-b-submethod-chip[data-color="neuro"].active        { background: rgba(192,84,110,0.12); border-color: rgba(192,84,110,0.40); color: #9E3A52; }
.hero-b-submethod-chip[data-color="brainstim"].active    { background: rgba(184,90,56,0.12);  border-color: rgba(184,90,56,0.40);  color: #924020; }
.hero-b-submethod-chip[data-color="eye"].active          { background: rgba(106,148,56,0.12); border-color: rgba(106,148,56,0.40); color: #4E7820; }
.hero-b-submethod-chip[data-color="behavioral"].active   { background: rgba(58,140,86,0.12);  border-color: rgba(58,140,86,0.40);  color: #246840; }
.hero-b-submethod-chip[data-color="selfreport"].active   { background: rgba(46,136,120,0.12); border-color: rgba(46,136,120,0.40); color: #186658; }
.hero-b-submethod-chip[data-color="computational"].active { background: rgba(78,120,176,0.12); border-color: rgba(78,120,176,0.40); color: #325E96; }
.hero-b-submethod-chip[data-color="physiological"].active { background: rgba(110,100,176,0.12); border-color: rgba(110,100,176,0.40); color: #524898; }
.hero-b-submethod-chip[data-color="acoustic"].active     { background: rgba(144,74,168,0.12); border-color: rgba(144,74,168,0.40); color: #6E2E88; }
.hero-b-submethod-chip[data-color="synthesis"].active    { background: rgba(176,72,120,0.12); border-color: rgba(176,72,120,0.40); color: #8E2C5C; }
.hero-b-submethod-chip[data-color="other"].active        { background: rgba(156,163,175,0.18); border-color: rgba(156,163,175,0.6); color: #374151; }

/* Exclude people toggle */
.hero-b-exclude-row {
    border-top: 1px solid var(--color-border-light);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.hero-b-exclude-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    padding: 0;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s;
}

.hero-b-exclude-toggle:hover {
    color: var(--color-text-primary);
}

.hero-b-exclude-count-badge {
    font-size: var(--font-xs);
    background: #FFF4E6;
    color: #D97706;
    border: 1px solid #FDE68A;
    border-radius: 99px;
    padding: 0.05rem 0.4rem;
    font-weight: 600;
}

.hero-b-chevron-sm {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.hero-b-exclude-toggle[aria-expanded="true"] .hero-b-chevron-sm {
    transform: rotate(180deg);
}

.hero-b-exclude-body {
    margin-top: 0.6rem;
}

.hero-b-exclude-search {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.375rem 0.625rem;
    font-family: var(--font-sans);
    font-size: var(--font-sm);
    outline: none;
    margin-bottom: 0.4rem;
    background: var(--color-surface);
}

.hero-b-exclude-search:focus {
    border-color: var(--color-univie-blue);
    background: white;
}

.hero-b-exclude-list {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
}

.hero-b-exclude-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.625rem;
    font-size: var(--font-sm);
    cursor: pointer;
    transition: background 0.1s;
}

.hero-b-exclude-item:hover {
    background: var(--color-surface);
}

.hero-b-exclude-item input[type="checkbox"] {
    accent-color: var(--color-univie-blue);
    flex-shrink: 0;
}

.hero-b-exclude-item.is-excluded {
    color: var(--color-text-secondary);
    text-decoration: line-through;
}

/* Action row */
.hero-b-opt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border-light);
    margin-top: 0.5rem;
}

.hero-b-collapse-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.hero-b-collapse-btn:hover {
    color: var(--color-text-primary);
    border-color: var(--color-text-secondary);
}

.hero-b-run-btn {
    background: var(--color-univie-blue);
    color: white;
    border: none;
    padding: 0.625rem 1.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-base);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, transform 0.1s ease;
}

.hero-b-run-btn:hover {
    background: var(--color-univie-blue-dark);
}

.hero-b-run-btn:active {
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .hero-b-title {
        font-size: 1.875rem;
    }

    .hero-b-subtitle {
        font-size: var(--font-base);
        margin-bottom: 1.5rem;
    }

    .hero-section-b {
        min-height: 50vh;
        padding: 3rem 0 2.5rem;
    }

    .hero-b-hint-inline {
        display: none;
    }
}

/* ============================================================
   Version C — Experimental Search Interface
   ============================================================ */

body.version-c .hero-section-b { display: none; }

.hero-section-c { display: none; }

body.version-c .hero-section-c {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    background: linear-gradient(160deg, #f8fafc 0%, #eef4f9 100%);
    border-bottom: 1px solid var(--color-border);
    padding: 4rem 0 3rem;
}

.hero-c-container {
    max-width: 660px;
    width: 100%;
    text-align: center;
    padding: 0 var(--spacing-lg);
}

.hero-c-brand {
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-univie-blue);
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.hero-c-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.hero-c-subtitle {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    margin: 0 0 1.6rem;
    line-height: 1.5;
}

/* Search box card */
.hero-c-search-box {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.4rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    text-align: left;
}

/* Type chips */
.hero-c-type-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.hero-c-type-chip {
    padding: 0.3rem 0.75rem;
    border: 1.5px solid var(--color-border);
    border-radius: 100px;
    background: transparent;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.hero-c-type-chip:hover {
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
}

.hero-c-type-chip.active {
    background: var(--color-univie-blue);
    border-color: var(--color-univie-blue);
    color: #fff;
    font-weight: 500;
}

/* Contextual hint */
.hero-c-type-hint {
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
    background: #f0f6fb;
    border-left: 3px solid var(--color-univie-blue);
    border-radius: 0 6px 6px 0;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    line-height: 1.45;
}

/* Textarea */
.hero-c-textarea-wrap { position: relative; }

.hero-c-textarea {
    width: 100%;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    padding: 0.7rem 0.9rem 1.6rem;
    font-size: var(--font-base);
    font-family: inherit;
    color: var(--color-text-primary);
    resize: none;
    line-height: 1.5;
    min-height: 90px;
    height: 90px;
    max-height: 280px;
    overflow-y: auto;
    transition: border-color 0.15s ease, height 0.18s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-sizing: border-box;
    will-change: height;
}

.hero-c-textarea:focus {
    outline: none;
    border-color: var(--color-univie-blue);
    box-shadow: 0 0 0 3px rgba(0, 92, 153, 0.1);
}

.hero-c-textarea.input-error {
    border-color: var(--color-error, #dc3545);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.hero-c-kbd-hint {
    position: absolute;
    bottom: 0.45rem;
    right: 0.6rem;
    font-size: 0.68rem;
    color: #bbb;
    pointer-events: none;
    font-family: inherit;
    letter-spacing: 0.01em;
}

/* Funding row */
.hero-c-funding-row { margin-top: 0.75rem; }

.hero-c-field-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 0.35rem;
}

.hero-c-call-select {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Call description textarea — fixed height, scrollable */
.hero-c-call-textarea {
    width: 100%;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: var(--font-sm);
    font-family: inherit;
    color: var(--color-text-primary);
    line-height: 1.55;
    resize: none;
    height: calc(7 * 1.55em - 1.2rem);
    overflow-y: auto;
    transition: border-color 0.15s;
}

.hero-c-call-textarea:focus {
    outline: none;
    border-color: var(--color-univie-blue);
}

/* Action row */
.hero-c-action-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.85rem;
}

.hero-c-run-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.3rem;
    background: var(--color-univie-blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: var(--font-base);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}

.hero-c-run-btn:hover { background: var(--color-univie-dark); }
.hero-c-run-btn:active { transform: scale(0.98); }
.hero-c-run-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.hero-c-customize-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.55rem 0.85rem;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: var(--font-sm);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.hero-c-customize-btn:hover {
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
}

.hero-c-customize-btn.active {
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
    background: #f0f6fb;
}

.hero-c-chevron { transition: transform 0.2s ease; }
.hero-c-customize-btn.active .hero-c-chevron { transform: rotate(180deg); }

/* Advanced options */
.hero-c-advanced {
    border-top: 1px solid var(--color-border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.hero-c-adv-note {
    font-size: var(--font-xs);
    color: #aaa;
    margin: 0 0 0.9rem;
    font-style: italic;
}

.hero-c-adv-section { margin-bottom: 1rem; }
.hero-c-adv-section:last-child { margin-bottom: 0; }

.hero-c-adv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.45rem;
}

.hero-c-adv-label {
    font-size: var(--font-sm);
    font-weight: 500;
    color: var(--color-text-primary);
}

.hero-c-adv-count {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
}

.hero-c-adv-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.3rem;
}

.hero-c-adv-chips-row:empty { display: none; }

/* Selectivity labels */
.hero-c-adv-sl-labels { display: flex; gap: 0.4rem; }

.hero-c-sl-opt {
    font-size: var(--font-xs);
    color: #bbb;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.hero-c-sl-opt.active {
    background: rgba(0, 92, 153, 0.08);
    color: var(--color-univie-blue);
    font-weight: 500;
}

/* Exclude (additive) */
.hero-c-exclude-count {
    font-size: var(--font-xs);
    color: var(--color-univie-blue);
    font-weight: 500;
}

.hero-c-exclude-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.hero-c-exclude-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.5rem 0.2rem 0.6rem;
    background: #fff0f0;
    border: 1px solid #f5c6cb;
    border-radius: 100px;
    font-size: var(--font-xs);
    color: #c0392b;
}

.hero-c-exclude-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border: none;
    background: none;
    color: #c0392b;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    line-height: 1;
    border-radius: 50%;
    transition: background 0.1s;
}

.hero-c-exclude-chip-remove:hover { background: rgba(192, 57, 43, 0.12); }

.hero-c-exclude-search {
    width: 100%;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    font-size: var(--font-sm);
    font-family: inherit;
    color: var(--color-text-primary);
    box-sizing: border-box;
}

.hero-c-exclude-search:focus {
    outline: none;
    border-color: var(--color-univie-blue);
}

.hero-c-exclude-suggestions {
    margin-top: 0.3rem;
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.hero-c-exclude-suggestions.hidden { display: none; }

.hero-c-excl-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.4rem 0.75rem;
    border: none;
    background: #fff;
    font-size: var(--font-sm);
    font-family: inherit;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s;
    color: var(--color-text-primary);
}

.hero-c-excl-suggestion:hover { background: #f0f6fb; }
.hero-c-excl-suggestion + .hero-c-excl-suggestion { border-top: 1px solid var(--color-border); }

.hero-c-excl-add-hint {
    font-size: 0.68rem;
    color: #bbb;
}

.hero-c-excl-no-results {
    padding: 0.5rem 0.75rem;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
}

/* Results summary */
.hero-c-results {
    border-top: 1px solid var(--color-border);
    margin-top: 1rem;
    padding-top: 1rem;
}

.hero-c-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.7rem;
}

.hero-c-results-label {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-primary);
}

.hero-c-results-clear {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    transition: color 0.15s;
}

.hero-c-results-clear:hover { color: var(--color-text-primary); }

.hero-c-results-row {
    display: flex;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
    overflow-x: auto;
}

.hero-c-result-card {
    flex: 1;
    min-width: 150px;
    max-width: 210px;
    background: #f8fafc;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    padding: 0.85rem 0.85rem 0.7rem;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
    text-align: left;
}

.hero-c-result-card:hover {
    border-color: var(--color-univie-blue);
    box-shadow: 0 2px 12px rgba(0, 92, 153, 0.1);
}

.hero-c-result-rank {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--color-univie-blue);
    opacity: 0.55;
}

.hero-c-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 0.45rem;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    flex-shrink: 0;
}

.hero-c-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-c-result-name {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-c-result-reason {
    font-size: 0.68rem;
    color: var(--color-text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hero-c-see-all-btn {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: var(--font-sm);
    color: var(--color-univie-blue);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}

.hero-c-see-all-btn:hover {
    background: #f0f6fb;
    border-color: var(--color-univie-blue);
}

/* Footer hint & switch button */
.hero-c-footer-hint {
    margin-top: 1rem;
    font-size: var(--font-sm);
    color: var(--color-text-secondary);
}

.hero-c-switch-btn {
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    color: var(--color-text-secondary);
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    transition: color 0.15s;
}

.hero-c-switch-btn:hover { color: var(--color-text-primary); }

/* "Try experimental" link in hero-b */
.hero-b-exp-btn {
    font-size: var(--font-xs);
    color: var(--color-text-secondary);
}

/* ---- Hero-b restructured layout ---- */

/* Example prompts — clickable suggestions below textarea */
.hero-b-examples {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0 0.75rem;
    overflow: hidden;
    max-height: 60px;
    opacity: 1;
    transition: opacity 0.15s ease;
}

.hero-b-examples.examples-hidden {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    pointer-events: none;
}

/* When examples collapse, expand textarea to fill the freed space so container height stays stable */
.hero-b-search-box:has(.hero-b-examples.examples-hidden) .hero-b-textarea {
    min-height: 194px; /* 148px base + ~46px examples row */
}
.hero-b-examples-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    opacity: 0.7;
    white-space: nowrap;
    flex-shrink: 0;
}
.hero-b-example-chip {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    border: 1px dashed #d4d8dc;
    border-radius: 100px;
    background: transparent;
    color: #8a9199;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    line-height: 1.3;
    white-space: nowrap;
}
.hero-b-example-chip:hover {
    background: #f4f5f6;
    border-color: #b8bdc3;
    color: #555d66;
}
.hero-b-example-chip:active {
    background: #eaecee;
}
.hero-b-example-chip.selected {
    background: #f0f2f4;
    border-style: solid;
    border-color: #b8bdc3;
    color: #555d66;
}
.hero-b-example-more {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.55rem;
    border: none;
    border-radius: 100px;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 0.72rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.hero-b-example-more:hover { opacity: 1; }

@media (max-width: 640px) {
    .hero-b-examples-label { display: none; }
    .hero-b-example-chip { font-size: 0.72rem; padding: 0.25rem 0.55rem; }
}

/* Type chips row — always visible below textarea, with separator */
.hero-b-type-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.65rem 0 0;
    border-top: 1px solid var(--color-border-light);
    margin-top: 0.15rem;
}

.hero-b-type-label {
    width: 100%;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    opacity: 0.7;
    margin-bottom: 0.1rem;
}

/* Action row: Customize (left) + Find Researchers (right) */
.hero-b-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.25rem 0 0;
}

/* Customize toggle button — matches hero-c style */
.hero-b-customize-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.55rem 0.85rem;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    background: #f3f4f6;
    color: var(--color-text-secondary);
    font-size: var(--font-sm);
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.hero-b-customize-btn:hover {
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
}

.hero-b-customize-btn.is-open {
    border-color: var(--color-univie-blue);
    color: var(--color-univie-blue);
    background: #f0f6fb;
}

/* Rotating chevron inside customize button */
.hero-b-chevron-sm {
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.hero-b-customize-btn.is-open .hero-b-chevron-sm {
    transform: rotate(180deg);
}

/* Advanced panel — expands below action row */
.hero-b-advanced {
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border-light);
    margin-top: 0;
    transition: max-height 0.38s ease, opacity 0.28s ease, margin-top 0.35s ease;
}

.hero-b-advanced.slide-open {
    margin-top: 0.75rem;
}

/* Funding row (shown when Funding Opportunity chip active) */
.hero-b-funding-row {
    padding-top: 0.75rem;
}

/* ---- Smooth expand/collapse utility ---- */
.slide-panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.38s ease, opacity 0.28s ease;
}

.slide-panel.slide-open {
    max-height: 900px; /* fallback; JS overrides with exact height */
    opacity: 1;
}

/* ---- Sort panel — floating dropdown, fade+slide animation ---- */
.sort-panel {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-6px) scale(0.98);
    transform-origin: top right;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.sort-panel.slide-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* ---- AI disclaimer banner ---- */
.ai-disclaimer-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #FFFBEB;
    border: 1px solid #FCD34D;
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
}

.ai-disclaimer-banner.hidden {
    display: none;
}

.ai-disclaimer-icon {
    color: #B45309;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.ai-disclaimer-content {
    flex: 1;
    min-width: 0;
}

.ai-disclaimer-main {
    font-size: var(--font-sm);
    color: #78350F;
    line-height: 1.6;
    margin: 0 0 0.35rem;
}

.ai-disclaimer-sub {
    font-size: 0.75rem;
    color: #92400E;
    line-height: 1.5;
    margin: 0;
}

.ai-disclaimer-dismiss {
    flex-shrink: 0;
    align-self: center;
    background: none;
    border: 1px solid #D97706;
    border-radius: var(--radius-sm);
    color: #92400E;
    font-size: 0.72rem;
    font-family: inherit;
    padding: 0.3rem 0.65rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.ai-disclaimer-dismiss:hover {
    background: #FEF3C7;
    color: #78350F;
}

/* ---- Sidebar overlap chips ---- */
.sidebar-overlap-section {
    margin-top: 0.75rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(146, 64, 14, 0.2);
}

.sidebar-overlap-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #92400E;
    margin-bottom: 0.4rem;
}

.sidebar-overlap-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.sidebar-overlap-chip {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background: rgba(255, 255, 255, 0.65);
    color: #78350F;
    border: 1px solid rgba(146, 64, 14, 0.3);
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 640px) {
    .hero-c-results-row {
        flex-direction: column;
    }
    .hero-c-result-card {
        max-width: 100%;
    }
    body.version-c .hero-section-c {
        padding: 2.5rem 0 2rem;
        min-height: 50vh;
    }
}



/* =============================================================================
   HOW THIS WORKS — Top bar + Trigger button
   ============================================================================= */

.top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 40px;
    margin-bottom: 1.25rem;
}

.hiw-trigger-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--color-text-secondary);
    padding: 4px 8px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    min-height: 44px;
}

.hiw-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--color-text-secondary);
    color: #fff;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.15s;
}

.hiw-trigger-btn:hover {
    background: rgba(0, 92, 153, 0.06);
    color: var(--color-univie-blue);
}

.hiw-trigger-btn:hover .hiw-btn-icon {
    background: var(--color-univie-blue);
}

/* =============================================================================
   HOW THIS WORKS — Modal overlay & box
   ============================================================================= */

.hiw-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: hiwFadeIn 0.18s ease;
}

.hiw-overlay.hidden {
    display: none;
}

@keyframes hiwFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.hiw-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 660px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    animation: hiwSlideUp 0.2s ease;
}

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

.hiw-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem 1.1rem;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}

.hiw-modal-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: #032138;
    margin: 0 0 0.2rem;
    line-height: 1.3;
}


.hiw-close-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
    margin-top: 0.1rem;
}

.hiw-close-btn:hover {
    color: #032138;
    background: #F3F4F6;
}

.hiw-modal-body {
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* =============================================================================
   HOW THIS WORKS — Sections
   ============================================================================= */

.hiw-section-heading {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #005C99;
    margin: 0 0 0.9rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #E5E7EB;
}

/* =============================================================================
   HOW THIS WORKS — 3-step flow
   ============================================================================= */

.hiw-steps {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hiw-step {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
}

.hiw-step-num {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #005C99;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.1rem;
}

.hiw-step-content strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #032138;
    margin-bottom: 0.25rem;
    font-family: 'Inter', sans-serif;
}

.hiw-step-content p {
    font-size: 0.81rem;
    color: #666;
    line-height: 1.65;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

/* =============================================================================
   HOW THIS WORKS — Info cards (for researchers in directory)
   ============================================================================= */

.hiw-info-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.hiw-info-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    background: #F8FAFC;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 0.85rem 1rem;
}

.hiw-info-icon {
    flex-shrink: 0;
    color: #005C99;
    margin-top: 0.1rem;
}

.hiw-info-card strong {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: #032138;
    margin-bottom: 0.2rem;
    font-family: 'Inter', sans-serif;
}

.hiw-info-card p {
    font-size: 0.79rem;
    color: #666;
    line-height: 1.6;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

/* =============================================================================
   HOW THIS WORKS — FAQ Accordion
   ============================================================================= */

.hiw-accordion {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
}

.hiw-acc-item {
    border-bottom: 1px solid #E5E7EB;
}

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

.hiw-acc-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: none;
    border: none;
    padding: 0.85rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.83rem;
    font-weight: 500;
    color: #032138;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

.hiw-acc-trigger:hover {
    background: #F8FAFC;
}

.hiw-acc-trigger[aria-expanded="true"] {
    color: #005C99;
    background: #EFF6FF;
}

.hiw-acc-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #666;
}

.hiw-acc-trigger[aria-expanded="true"] .hiw-acc-chevron {
    transform: rotate(180deg);
    color: #005C99;
}

.hiw-acc-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.32s ease, opacity 0.22s ease, padding 0.22s ease;
    padding: 0 1rem;
}

.hiw-acc-content.hiw-acc-open {
    max-height: 400px;
    opacity: 1;
    padding: 0.75rem 1rem 1rem;
}

.hiw-acc-content p {
    font-size: 0.8rem;
    color: #555;
    line-height: 1.7;
    margin: 0 0 0.55rem;
    font-family: 'Inter', sans-serif;
}

.hiw-acc-content p:last-child {
    margin-bottom: 0;
}

/* =============================================================================
   HOW THIS WORKS — About section
   ============================================================================= */

.hiw-about {
    border-top: 1px solid #E5E7EB;
    padding-top: 1.1rem;
}

.hiw-about p {
    font-size: 0.76rem;
    color: #888;
    line-height: 1.65;
    margin: 0;
    font-family: 'Inter', sans-serif;
}

.hiw-about a {
    color: #005C99;
    text-decoration: none;
}

.hiw-about a:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .hiw-overlay {
        padding: 0.5rem;
        align-items: flex-end;
    }
    .hiw-modal {
        max-height: 92vh;
        border-radius: 16px 16px 8px 8px;
    }
    .hiw-modal-body {
        padding: 1.1rem;
    }
}

/* =============================================================================
   Mobile overrides — must come AFTER all base rules to win the cascade
   ============================================================================= */
@media (max-width: 640px) {

    /* Call cards on mobile */
    .hero-b-call-card {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Action row: stack so Find Researchers doesn't overflow */
    .hero-b-action-row {
        flex-direction: column;
    }
    .hero-b-run-btn {
        width: 100%;
    }

    /* Prevent horizontal overflow from scope count */
    .hero-b-scope-count {
        min-width: 0;
    }
}

/* Launch Banner */
.launch-banner {
    background: #f0f6fb;
    border-bottom: 1px solid #c4dff0;
}
.launch-banner.hidden { display: none; }

.launch-banner-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.85rem 1.2rem 0.65rem;
    position: relative;
}
.launch-banner-body {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}
.launch-banner-icon {
    color: var(--color-univie-blue);
    font-size: 1.05rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
}
.launch-banner-text {
    font-size: 0.875rem;
    color: #334;
    line-height: 1.45;
    padding-right: 1.8rem;
}
.launch-banner-text strong {
    color: var(--color-univie-blue);
}
.launch-banner-progress-text {
    display: block;
    margin-top: 0.2rem;
    color: #556;
}
.launch-banner-progress-bar-wrap {
    margin-top: 0.55rem;
    height: 4px;
    background: #d0e8f5;
    border-radius: 2px;
    overflow: hidden;
}
.launch-banner-progress-bar {
    height: 100%;
    background: var(--color-univie-blue);
    border-radius: 2px;
    transition: width 0.6s ease;
    width: 0%;
}
.launch-banner-dismiss {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #889;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
}
.launch-banner-dismiss:hover { color: var(--color-univie-blue); }

/* Profile updated success banner (inside profile sidebar, shown after save redirect) */
.profile-updated-banner {
    background: rgba(34, 197, 94, 0.07);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.75rem;
}
.profile-updated-banner-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
}
.profile-updated-banner-check {
    color: #22c55e;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.profile-updated-banner-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #15803d;
    flex: 1;
}
.profile-updated-banner-sub {
    font-size: 0.825rem;
    color: #4b7a5e;
    line-height: 1.5;
    margin: 0 0 0.55rem 1.35rem;
}
.profile-updated-edit-link {
    display: inline-block;
    margin-left: 1.35rem;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--color-univie-blue);
    text-decoration: none;
}
.profile-updated-edit-link:hover { text-decoration: underline; }
.profile-updated-banner-close {
    background: none;
    border: none;
    color: #86efac;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem 0.3rem;
    margin: -0.2rem -0.3rem -0.2rem auto;
    transition: color 0.15s;
}
.profile-updated-banner-close:hover { color: #15803d; }

/* Filter empty state */
.filter-empty-note {
    font-size: 0.78rem;
    color: #999;
    font-style: italic;
    padding: 0.25rem 0;
    display: block;
}


/* ============================================================
   Listing Request Modal
   ============================================================ */

.lr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}
.lr-overlay.hidden { display: none; }

.lr-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    box-sizing: border-box;
}

.lr-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #888;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    z-index: 1;
}
.lr-modal-close:hover { color: #333; background: #f0f0f0; }

.lr-modal-header {
    padding: 1.75rem 2rem 0;
}
.lr-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 0.35rem;
}
.lr-modal-sub {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    margin: 0 0 1.25rem;
    line-height: 1.5;
}

.lr-form {
    padding: 0 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.lr-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    min-width: 0;
}
/* Grid children must have min-width:0 or they can blow out the column */
.lr-form-row > * {
    min-width: 0;
}
@media (max-width: 540px) {
    .lr-form-row { grid-template-columns: 1fr; }
    .lr-modal-header { padding: 1.25rem 1.25rem 0; }
    .lr-form { padding: 0 1.25rem 1.25rem; }
}

.lr-field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }

.lr-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-primary);
}
.lr-label-opt { font-weight: 500; }
.lr-opt { font-weight: 400; color: var(--color-text-secondary); }

.lr-input {
    border: 1.5px solid var(--color-border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--color-text-primary);
    background: #fff;
    transition: border-color 0.15s;
    width: 100%;
    box-sizing: border-box;
}
.lr-input:focus {
    outline: none;
    border-color: var(--color-univie-blue);
    box-shadow: 0 0 0 3px rgba(0,92,153,0.1);
}
.lr-textarea { resize: vertical; min-height: 70px; }

.lr-privacy {
    font-size: 0.75rem;
    color: #888;
    margin: 0;
    line-height: 1.5;
}
.lr-privacy a { color: var(--color-univie-blue); }

.lr-submit-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.lr-error {
    font-size: 0.82rem;
    color: #dc2626;
}
.lr-error.hidden { display: none; }

.lr-success {
    padding: 2.5rem 2rem;
    text-align: center;
}
.lr-success.hidden { display: none; }
.lr-success-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #dcfce7;
    color: #16a34a;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-weight: 700;
}
.lr-success h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 0.5rem;
}
.lr-success p {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* ---- Select in listing request form ---- */
.lr-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    cursor: pointer;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* ---- Field-level validation error states ---- */
.lr-input.lr-input-error {
    border-color: #dc2626;
    background-color: rgba(220,38,38,0.04);
}
.lr-input.lr-input-error:focus {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220,38,38,0.12);
}
.lr-label.lr-label-error {
    color: #dc2626;
}
.lr-field-msg {
    font-size: 0.72rem;
    color: #dc2626;
    margin-top: 0.1rem;
    display: none;
}
.lr-field-msg.visible {
    display: block;
}

/* ---- Empty state listing CTA ---- */
.empty-state-listing-cta {
    margin-top: 1.25rem;
    font-size: 0.82rem;
    color: var(--color-text-secondary);
}
.empty-state-listing-link {
    background: none;
    border: none;
    color: var(--color-univie-blue);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-family: inherit;
}
.empty-state-listing-link:hover { color: var(--color-univie-dark); }
