:root {
    --portal-bg: #05060b;
    --portal-card: #10121d;
    --portal-border: #1f2232;
    --portal-accent: #35f18c;
    --portal-accent-2: #f7b731;
    --portal-text: #e5f3ff;
    --portal-muted: #8fa1b8;
    --portal-highlight: rgba(53, 241, 140, 0.15);
    --portal-font: 'ClashDisplay', 'Space Mono', 'Courier New', monospace;
}

.portal-body {
    background: var(--portal-bg);
    color: var(--portal-text);
    font-family: 'Space Grotesk', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.portal-nav {
    background: rgba(5, 6, 11, 0.85);
    border-bottom: 1px solid var(--portal-border);
    backdrop-filter: blur(6px);
}

.portal-nav .logo {
    color: var(--portal-accent);
    letter-spacing: 0.2em;
}

.portal-nav .nav-links a.active {
    color: var(--portal-accent-2);
}

.portal-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.portal-nav .nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Enhanced Navigation Styles - Portal Version */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-link-with-dropdown {
    display: inline-block;
    padding: 0.5rem 1rem;
    color: var(--portal-muted);
    text-decoration: none;
    transition: color 0.3s ease;
    cursor: pointer;
}

.nav-link-with-dropdown:hover,
.nav-link-with-dropdown.active {
    color: var(--portal-text);
}

.nav-research {
    color: var(--portal-accent) !important;
    font-weight: 500;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--portal-card);
    border: 1px solid rgba(53, 241, 140, 0.3);
    border-radius: 8px;
    padding: 1.5rem;
    min-width: 480px;
    display: none;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-top: 0;
    padding-top: 2rem;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.nav-dropdown:hover .dropdown-menu,
.dropdown-menu:hover {
    display: grid;
    opacity: 1;
    pointer-events: auto;
}

.dropdown-section h4 {
    color: var(--portal-text);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(53, 241, 140, 0.3);
}

.dropdown-section a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: var(--portal-muted);
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.dropdown-section a:hover {
    background: rgba(53, 241, 140, 0.1);
    color: var(--portal-accent);
    padding-left: 1rem;
}

.dropdown-section a.featured-link {
    background: linear-gradient(135deg, rgba(53, 241, 140, 0.1), rgba(247, 183, 49, 0.1));
    border: 1px solid rgba(53, 241, 140, 0.3);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.dropdown-section a.featured-link:hover {
    background: linear-gradient(135deg, rgba(53, 241, 140, 0.15), rgba(247, 183, 49, 0.15));
    border-color: rgba(53, 241, 140, 0.5);
}

.dropdown-section a.featured-link strong {
    color: var(--portal-accent);
    display: block;
    margin-bottom: 0.25rem;
}

.link-desc {
    font-size: 0.75rem;
    color: var(--portal-muted);
    display: block;
}

.mobile-dropdown-toggle {
    display: none;
    background: var(--portal-accent);
    border: 1px solid var(--portal-border);
    color: var(--portal-bg);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 0.3rem;
    transition: all 0.2s ease;
    font-weight: 600;
}

.mobile-dropdown-toggle:hover {
    background: var(--portal-accent-2);
    color: var(--portal-bg);
}

@media (min-width: 1025px) {
    .nav-dropdown:hover .dropdown-menu {
        display: grid;
        opacity: 1;
        pointer-events: auto;
    }
}

/* Mobile Menu Styles */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
}

.mobile-menu-toggle span {
    width: 30px;
    height: 3px;
    background: var(--portal-text);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.mobile-dropdown-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--portal-accent);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-left: auto;
}

@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .signin {
        display: none;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 400px;
        height: 100vh;
        background: var(--portal-card);
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: 80px 0 20px 0;
        overflow-y: auto;
        transition: right 0.3s ease;
        z-index: 100;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        border-left: 1px solid var(--portal-border);
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links > a,
    .nav-dropdown {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav-links > a {
        padding: 1rem 1.5rem;
        display: block;
    }

    .nav-dropdown {
        display: flex;
        flex-direction: column;
    }

    .nav-link-with-dropdown {
        padding: 1rem 1.5rem;
        width: 100%;
        text-align: left;
    }

    .mobile-dropdown-toggle {
        display: block;
        position: absolute;
        right: 1rem;
        top: 0.5rem;
    }

    .mobile-dropdown-toggle.active {
        transform: rotate(45deg);
    }

    .dropdown-menu {
        position: static;
        transform: none;
        margin: 0;
        padding: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.2);
        min-width: 100%;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        pointer-events: all;
        transition: max-height 0.3s ease;
    }

    .dropdown-menu.active {
        max-height: 1000px;
    }

    .dropdown-menu {
        display: block !important;
    }

    .dropdown-section {
        padding: 1rem 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .dropdown-section:last-child {
        border-bottom: none;
    }
}

.portal-hero {
    padding: 2.5rem 1rem 1.2rem;
    background: linear-gradient(135deg, rgba(53, 241, 140, 0.12), rgba(5, 6, 11, 0.9));
    border-bottom: 1px solid var(--portal-border);
}

.portal-hero__container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.portal-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--portal-accent);
    border-radius: 999px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: var(--portal-accent);
}

.portal-hero__content {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.portal-hero__content h1 {
    font-size: clamp(2rem, 4vw, 2.8rem);
    margin-bottom: 0.5rem;
    font-family: var(--portal-font);
}

.portal-hero__content p {
    max-width: 560px;
    color: var(--portal-muted);
}

.portal-hero__stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 220px;
}

.portal-home-button,
.portal-brand-note {
    border: 1px solid var(--portal-border);
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(5, 6, 11, 0.6);
}

.portal-home-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.portal-home-button span {
    font-size: 0.85rem;
    color: var(--portal-muted);
}

.btn-home {
    border: 1px solid var(--portal-accent);
    color: var(--portal-accent);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-home:hover {
    background: var(--portal-accent);
    color: #05060b;
}

/* Account controls shown when logged in (keeps same visual language as the home button) */
.portal-account-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.portal-account-controls .btn-home {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.06);
    background: linear-gradient(135deg, rgba(53,241,140,0.03), rgba(53,241,140,0.02));
}

.portal-account-name {
    font-weight: 600;
    color: var(--portal-text);
    font-size: 0.95rem;
}

.btn-link {
    color: var(--portal-accent);
    text-decoration: none;
    border: 1px solid var(--portal-border);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
}

.btn-link:hover {
    border-color: var(--portal-accent);
}

.portal-brand-note {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--portal-muted);
}

.portal-tabs {
    max-width: 1100px;
    margin: 1rem auto 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    padding: 0 1rem;
}

.portal-tab {
    border: 1px solid var(--portal-border);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    color: var(--portal-muted);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.01);
    transition: border 0.2s, color 0.2s, background 0.2s;
}

.portal-tab__icon {
    font-size: 1.2rem;
}

.portal-tab.active {
    border-color: var(--portal-accent);
    color: var(--portal-text);
    background: var(--portal-highlight);
    box-shadow: 0 0 12px rgba(53, 241, 140, 0.2);
}

.portal-content-shell {
    max-width: 1100px;
    margin: 1.5rem auto 3rem;
    padding: 0 1rem;
}

.portal-panel {
    background: var(--portal-card);
    border: 1px solid var(--portal-border);
    border-radius: 1.25rem;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.stat-card {
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    color: var(--portal-accent-2);
    font-family: var(--portal-font);
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--portal-muted);
}

.portal-section-title {
    font-family: var(--portal-font);
    margin: 2rem 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.portal-lede {
    color: var(--portal-muted);
    max-width: 640px;
}

.portal-card {
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 1rem;
    position: relative;
}

.portal-highlights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.portal-card__meta {
    font-size: 0.8rem;
    color: var(--portal-muted);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.portal-card__actions {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Document thumbnail in top right */
.document-thumbnail {
    width: 110px;
    height: 150px;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--portal-border);
    transition: all 0.2s ease;
    opacity: 0.7;
    margin-left: auto;
    flex-shrink: 0;
}

.document-thumbnail:hover {
    border-color: var(--portal-accent);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(53, 241, 140, 0.3);
}

.document-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.document-thumbnail:hover img {
    transform: scale(1.1);
}

/* Enhanced image view button */
.btn-image-view {
    background: linear-gradient(135deg, var(--portal-accent), var(--portal-accent-2)) !important;
    border: none !important;
    color: #000 !important;
    font-weight: 600 !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 8px rgba(53, 241, 140, 0.3) !important;
}

.btn-image-view:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 16px rgba(53, 241, 140, 0.4) !important;
}

.btn-image-view:active {
    transform: translateY(0) !important;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    font-size: 0.75rem;
    border: 1px solid var(--portal-border);
    color: var(--portal-muted);
}

.badge--tier1 {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5) !important;
}

.priority-tier1 {
    background: #dc2626 !important;
    color: #ffffff !important;
    border-color: #dc2626 !important;
    animation: pulse-red 2s infinite;
}

.priority-tier2 {
    background: #ea580c !important;
    color: #ffffff !important;
    border-color: #ea580c !important;
}

.priority-tier3 {
    background: #ca8a04 !important;
    color: #000000 !important;
    border-color: #ca8a04 !important;
}

.badge--ai-score {
    background: rgba(53, 241, 140, 0.1);
    border-color: var(--portal-accent);
    color: var(--portal-accent);
}

.api-key-notice {
    background: rgba(247, 183, 49, 0.1);
    border: 1px solid var(--portal-accent-2);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.api-key-notice code {
    background: rgba(0,0,0,0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
}

.smoking-gun-card {
    border-left: 4px solid var(--portal-accent-2);
    margin-bottom: 2rem;
}

.rank {
    font-weight: 700;
    color: var(--portal-accent-2);
    font-size: 1.1rem;
}

.smoking-gun-title {
    color: var(--portal-text);
    margin: 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.smoking-gun-explanation {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.key-evidence {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.key-evidence strong {
    color: var(--portal-accent);
    display: block;
    margin-bottom: 0.5rem;
}

.key-evidence ul {
    margin: 0;
    padding-left: 1.5rem;
}

.key-evidence li {
    color: var(--portal-text);
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.entity-connections {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.connection-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.connection-tag {
    background: rgba(255, 107, 107, 0.2);
    color: #ff6b6b;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.explanation-text.ai-generated {
    color: var(--portal-text);
    font-style: normal;
    border-left: 3px solid var(--portal-accent);
    padding-left: 1rem;
    background: rgba(0, 255, 136, 0.05);
}

.explanation-text.legacy {
    color: var(--portal-text-secondary);
    font-style: italic;
}

.explanation-text.pending {
    color: var(--portal-text-secondary);
    font-style: italic;
    opacity: 0.7;
}

.analysis-status {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.status-metric {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-label {
    color: var(--portal-text-secondary);
    font-size: 0.9rem;
}

.metric-value {
    color: var(--portal-accent);
    font-weight: 700;
    font-size: 1.1rem;
}

.metric-detail {
    color: var(--portal-text-secondary);
    font-size: 0.8rem;
}

.batch-command {
    margin-left: auto;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Smoking Gun Controls */
.smoking-gun-controls {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group label {
    color: var(--portal-text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.control-group input[type="text"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--portal-text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 200px;
}

.control-group select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--portal-text-primary);
    padding: 0.45rem 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 200px;
    appearance: none;
}

.control-group input[type="text"]:focus {
    outline: none;
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.search-btn {
    background: #2a8f5c;
    border: 1px solid #2a8f5c;
    color: var(--portal-bg);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    transition: all 0.2s ease;
}

.search-btn:hover {
    background: #1f6b46;
    border-color: #1f6b46;
}

.clear-filters-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--portal-text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--portal-text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Modal Navigation */
.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1001;
}

.modal-nav:hover:not(:disabled) {
    background: var(--portal-accent);
    transform: translateY(-50%) scale(1.1);
}

.modal-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: translateY(-50%);
}

.modal-nav:disabled:hover {
    transform: translateY(-50%) scale(1);
    background: rgba(0, 0, 0, 0.7);
}

.modal-prev {
    left: 20px;
}

.modal-next {
    right: 20px;
}

.control-group select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--portal-text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 120px;
}

.control-group select:focus {
    outline: none;
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.pagination-info {
    text-align: center;
    color: var(--portal-text-secondary);
    font-size: 0.9rem;
    margin: 0.5rem 0 1rem 0;
}

.filter-indicator {
    display: inline-block;
    background: rgba(255, 107, 53, 0.2);
    color: var(--portal-accent);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 0.5rem;
    border: 1px solid rgba(255, 107, 53, 0.3);
}

/* Pagination Navigation */
.pagination-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.pagination-btn {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--portal-text-primary);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pagination-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--portal-accent);
}

.pagination-btn.current {
    background: var(--portal-accent);
    color: var(--portal-bg);
    font-weight: 700;
    border-color: var(--portal-accent);
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pagination-ellipsis {
    color: var(--portal-text-secondary);
    padding: 0 0.5rem;
    font-size: 0.9rem;
}

.batch-command code {
    color: var(--portal-accent);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.explanation-text {
    color: var(--portal-text);
    line-height: 1.6;
    margin: 0;
    font-style: italic;
}

.origin, .bates {
    color: var(--portal-muted);
    margin-right: 1rem;
}

.categories {
    margin-top: 0.5rem;
}

.category-tag {
    display: inline-block;
    background: rgba(53, 241, 140, 0.1);
    color: var(--portal-accent);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    margin: 0.2rem 0.3rem 0.2rem 0;
    border: 1px solid rgba(53, 241, 140, 0.2);
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* API Configuration Styles */
.api-config-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 2rem;
    margin: 2rem 0;
}

.api-config-form {
    max-width: 500px;
}

.api-config-form .form-group {
    margin-bottom: 1.5rem;
}

.api-config-form label {
    display: block;
    color: var(--portal-text);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.api-config-form input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    background: var(--portal-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--portal-text);
    font-family: inherit;
    font-size: 0.9rem;
}

.api-config-form input[type="password"]:focus {
    outline: none;
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 2px rgba(53, 241, 140, 0.2);
}

.form-help {
    color: var(--portal-muted);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.form-help a {
    color: var(--portal-accent);
    text-decoration: none;
}

.form-help a:hover {
    text-decoration: underline;
}

.api-status {
    background: rgba(53, 241, 140, 0.1);
    border: 1px solid var(--portal-accent);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.entity-card {
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
}

.entity-card__head {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.entity-card__count {
    font-size: 2rem;
    color: var(--portal-accent);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.image-card {
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    background: rgba(0, 0, 0, 0.6);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.image-card:hover {
    transform: translateY(-4px);
}

.image-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.image-card__meta {
    padding: 0.6rem 0.8rem 1rem;
}

.search-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
    margin: 1rem 0;
}

.search-filters input,
.search-filters select {
    width: 100%;
    padding: 0.65rem 0.8rem;
    border-radius: 0.6rem;
    border: 1px solid var(--portal-border);
    background: rgba(5, 6, 11, 0.6);
    color: var(--portal-text);
}

.search-filters__actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-filters__actions .btn-secondary,
.search-filters__actions .btn-primary {
    padding: 0.65rem 1.2rem;
    text-decoration: none;
    display: inline-block;
    min-width: 130px;
}

.btn-secondary {
    border: 1px solid var(--portal-border);
    background: transparent;
    color: var(--portal-text);
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
}

.btn-primary {
    border: none;
    background: var(--portal-accent);
    color: #05060b;
    border-radius: 999px;
    padding: 0.5rem 1.1rem;
    cursor: pointer;
}

.portal-footer {
    border-top: 1px solid var(--portal-border);
    padding: 2rem 1rem;
    background: rgba(0, 0, 0, 0.55);
}

.portal-footer__container {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    color: var(--portal-muted);
}

.portal-footer__links a {
    color: var(--portal-muted);
    margin-left: 1rem;
    text-decoration: none;
}

.lightbox,
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active,
.lightbox.active {
    display: flex;
}

.modal-content {
    width: min(90vw, 1000px);
    background: var(--portal-card);
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-header {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.modal-title-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.modal-bates {
    font-weight: 600;
    color: var(--portal-accent-2);
    font-size: 0.85rem;
    letter-spacing: 0.1rem;
    text-transform: uppercase;
}

.modal-subject {
    margin: 0;
    font-size: clamp(1.35rem, 2.4vw, 1.85rem);
    color: var(--portal-accent-2);
    line-height: 1.3;
    font-family: var(--portal-font);
}

.modal-metadata-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--portal-muted);
}

.modal-metadata-row span {
    display: inline-flex;
    gap: 0.25rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    background: transparent;
    color: var(--portal-text);
    font-size: 2rem;
    cursor: pointer;
}

.modal-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    background: #000;
}

.modal-image-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.5rem 0;
}

.modal-image {
    max-width: min(85vw, 900px);
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border: 1px solid var(--portal-border);
    border-radius: 0.5rem;
    background: #000;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.45);
}

.modal-nav-row {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.25rem;
}

.modal-info {
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: var(--portal-muted);
}

.modal-info__hint {
    margin: 0;
    text-align: center;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.category-summary {
    border: 1px solid var(--portal-border);
    border-radius: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
}

.modal-prev,
.modal-next {
    font-size: 1rem;
    background: rgba(5, 6, 11, 0.8);
    border: 1px solid var(--portal-border);
    border-radius: 999px;
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--portal-text);
    font-weight: 600;
    gap: 0.3rem;
    transition: background 0.2s ease, transform 0.2s ease;
    position: static;
    left: auto;
    right: auto;
    top: auto;
    transform: none;
}

.modal-prev:hover,
.modal-next:hover {
    background: rgba(53, 241, 140, 0.2);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .portal-hero__content {
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-panel {
        padding: 1.5rem;
    }

    .search-filters {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .search-filters__actions {
        grid-column: 1;
        width: 100%;
        justify-content: flex-end;
    }

    .smoking-gun-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .control-group label {
        width: 100%;
    }

    .control-group input[type="text"],
    .control-group select {
        width: 100%;
        min-width: 0;
    }

    .search-btn {
        width: 100%;
        margin-left: 0;
    }

    .modal-nav-row {
        flex-wrap: wrap;
        width: 100%;
        gap: 0.5rem;
    }
}

@media (max-width: 640px) {
    .search-filters__actions {
        justify-content: space-between;
    }

    .search-filters__actions .btn-secondary,
    .search-filters__actions .btn-primary {
        flex: 1 1 calc(50% - 0.4rem);
        text-align: center;
    }
}

/* Comments UI Styles */
.smoking-gun-comments {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--portal-border);
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    overflow: hidden;
}

.smoking-gun-comments-hidden {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
    border-top: none;
}

.comments-list {
    margin-bottom: 1rem;
}

.comments-list.empty {
    color: var(--portal-muted);
    font-style: italic;
    padding: 1rem 0;
}

.comment {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.comment-meta strong {
    color: var(--portal-accent);
    font-weight: 600;
}

.comment-time {
    color: var(--portal-muted);
    font-size: 0.8rem;
}

.comment-body {
    color: var(--portal-text);
    line-height: 1.5;
    font-size: 0.9rem;
}

.comment-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--portal-border);
}

.comment-form label {
    display: block;
    color: var(--portal-text);
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

.comment-form textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--portal-border);
    border-radius: 6px;
    padding: 0.75rem;
    color: var(--portal-text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--portal-accent);
    box-shadow: 0 0 0 2px rgba(53, 241, 140, 0.2);
}

.comment-form-actions {
    margin-top: 0.75rem;
    display: flex;
    justify-content: flex-end;
}

.comment-flash {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.comment-flash.success {
    background: rgba(53, 241, 140, 0.1);
    border: 1px solid var(--portal-accent);
    color: var(--portal-accent);
}

.comment-flash.error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
}

.comment-login-cta {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--portal-border);
    text-align: center;
}

.comments-see-all-link {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(53, 241, 140, 0.1);
    border: 1px solid var(--portal-accent);
    border-radius: 6px;
    color: var(--portal-accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.comments-see-all-link:hover {
    background: rgba(53, 241, 140, 0.2);
    border-color: var(--portal-accent);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(53, 241, 140, 0.3);
}

.btn-comments {
    transition: all 0.2s ease;
}

.btn-comments.active {
    background: rgba(53, 241, 140, 0.2);
    border-color: var(--portal-accent);
    color: var(--portal-accent);
    box-shadow: 0 0 8px rgba(53, 241, 140, 0.3);
}

/* Document Detail Page */
.document-detail-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.document-detail-page .portal-card {
    margin-bottom: 2rem;
}

.document-detail-page .smoking-gun-comments {
    max-height: none;
    opacity: 1;
    padding-top: 1rem;
    border-top: 1px solid var(--portal-border);
}

.document-detail-page .smoking-gun-comments-hidden {
    display: block;
    max-height: none;
    opacity: 1;
    padding-top: 1rem;
    border-top: 1px solid var(--portal-border);
}

/* Entity Detail View */
.entity-detail-panel {
    max-width: 1400px;
    margin: 0 auto;
}

.entity-documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.entity-document-card {
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.entity-document-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.entity-document-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1rem 0 0.75rem;
    line-height: 1.4;
}

.entity-document-title a:hover {
    color: var(--portal-accent);
    text-decoration: underline;
}

.entity-document-explanation {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.entity-document-explanation .explanation-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--portal-muted);
    margin-bottom: 0.75rem;
}

.entity-document-explanation .key-evidence {
    margin-top: 1rem;
    padding: 0.75rem;
    background: rgba(53, 241, 140, 0.05);
    border-left: 3px solid var(--portal-accent);
    border-radius: 4px;
}

.entity-document-explanation .key-evidence strong {
    color: var(--portal-accent);
    display: block;
    margin-bottom: 0.5rem;
}

.entity-document-explanation .key-evidence ul {
    margin: 0.5rem 0 0 1.25rem;
    padding: 0;
    list-style-type: disc;
}

.entity-document-explanation .key-evidence li {
    margin-bottom: 0.25rem;
    color: var(--portal-text);
    font-size: 0.9rem;
}

.document-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.category-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(53, 241, 140, 0.1);
    border: 1px solid rgba(53, 241, 140, 0.3);
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--portal-accent);
    font-weight: 500;
}

.entity-document-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--portal-border);
}

.entity-document-actions .btn-secondary,
.entity-document-actions .btn-comments {
    flex: 1;
    text-align: center;
}

.badge--comments {
    background: rgba(247, 183, 49, 0.1);
    border-color: var(--portal-accent-2);
    color: var(--portal-accent-2);
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--portal-muted);
}

.empty-state p {
    font-size: 1.1rem;
}

/* Entity Grid (List View) */
.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.entity-card {
    background: var(--portal-card);
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s ease;
}

.entity-card:hover {
    border-color: var(--portal-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(53, 241, 140, 0.2);
}

.entity-card__head {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--portal-text);
}

.entity-card__count {
    font-size: 2rem;
    font-weight: 700;
    color: var(--portal-accent);
    margin-bottom: 0.5rem;
}

.entity-card .portal-card__meta {
    margin-bottom: 1rem;
    color: var(--portal-muted);
    font-size: 0.9rem;
}

/* Responsive adjustments for entity documents */
@media (max-width: 768px) {
    .entity-documents-grid {
        grid-template-columns: 1fr;
    }
    
    .entity-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .entity-document-actions {
        flex-direction: column;
    }
}

