/* SHARE Research Portal - Stylesheet */

@font-face {
    font-family: 'Instrument Sans';
    src: url('https://share-austria.at/wp-content/themes/share-austria/assets/fonts/instrument-sans-v1-latin-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Instrument Sans';
    src: url('https://share-austria.at/wp-content/themes/share-austria/assets/fonts/instrument-sans-v1-latin-600.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-color: #fd6702;
    --primary-light: #ff8f43;
    --accent-color: #fd6702;
    --accent-deep: #d65600;
    --secondary-color: #1a5f74;
    --secondary-soft: #d9e7ea;
    --success-color: #008264;
    --warning-color: #ca495b;
    --error-color: #ca495b;
    --bg-color: #f3eee5;
    --bg-soft: #fbf7f1;
    --card-bg: #fffdf8;
    --surface-alt: #eef4f5;
    --text-primary: #181512;
    --text-secondary: #655e57;
    --border-color: #e7ddd0;
    --shadow: 0 14px 30px rgba(34, 29, 24, 0.08);
    --shadow-lg: 0 24px 60px rgba(34, 29, 24, 0.12);
    --radius-lg: 24px;
    --radius-md: 18px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 28%),
        linear-gradient(180deg, #f7f1e7 0%, #f3eee5 46%, #eef3f2 100%);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: none;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container.chat-layout {
    padding-left: 8px;
    padding-right: 8px;
}

.container.chat-layout main,
.container.chat-layout #chat-section,
.container.chat-layout #data-analyst-section {
    width: 100%;
}

/* Header */
header {
    padding: 0;
}

.logo {
    margin-bottom: 0;
}

.share-logo {
    height: 54px;
    width: auto;
}

header h1 {
    color: var(--text-primary);
    font-size: clamp(2.7rem, 5vw, 4.6rem);
    font-weight: 600;
    line-height: 0.98;
    letter-spacing: -0.04em;
    margin-bottom: 14px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.15rem;
    max-width: 38rem;
}

.portal-hero {
    position: relative;
    width: calc(100% - 4vw);
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 32px;
    padding: 28px 30px 24px;
    border-radius: 34px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 249, 239, 0.9) 58%, rgba(231, 241, 243, 0.92) 100%);
    border: 1px solid rgba(198, 181, 162, 0.4);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.portal-hero::before {
    content: '';
    position: absolute;
    top: -140px;
    right: -80px;
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, rgba(253, 103, 2, 0.18) 0%, rgba(253, 103, 2, 0) 70%);
    pointer-events: none;
}

.portal-hero::after {
    content: '';
    position: absolute;
    bottom: -130px;
    left: -90px;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(26, 95, 116, 0.16) 0%, rgba(26, 95, 116, 0) 72%);
    pointer-events: none;
}

.hero-topbar,
.hero-grid,
.header-nav {
    position: relative;
    z-index: 1;
}

.hero-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 28px;
}

.hero-branding {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hero-mini-title {
    display: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.95fr);
    gap: 28px;
    align-items: stretch;
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(198, 181, 162, 0.28);
}

.hero-copy {
    padding-right: 12px;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    margin-bottom: 16px;
    border-radius: 999px;
    background: rgba(26, 95, 116, 0.09);
    color: var(--secondary-color);
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.hero-description {
    max-width: 42rem;
    margin-top: 8px;
    font-size: 1.04rem;
    color: var(--text-secondary);
}


.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.hero-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 20px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s, color 0.2s;
}

.hero-link:hover {
    transform: translateY(-1px);
}

.hero-link-primary {
    color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(26, 95, 116, 0.16);
    box-shadow: none;
}

.hero-link-secondary {
    color: var(--secondary-color);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(26, 95, 116, 0.16);
    box-shadow: none;
}

.section-link.active.hero-link-primary {
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-deep));
    box-shadow: 0 16px 28px rgba(253, 103, 2, 0.26);
}

.section-link.active.hero-link-secondary {
    color: white;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-deep));
    border-color: transparent;
    box-shadow: 0 16px 28px rgba(253, 103, 2, 0.26);
}

.hero-highlights {
    display: grid;
    gap: 14px;
}

.hero-card {
    padding: 20px 22px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(198, 181, 162, 0.38);
    box-shadow: 0 10px 28px rgba(34, 29, 24, 0.06);
}

.hero-card-accent {
    background: linear-gradient(135deg, rgba(26, 95, 116, 0.95), rgba(33, 111, 132, 0.88));
    border-color: rgba(26, 95, 116, 0.42);
    color: #f9faf9;
}

.hero-card-label {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hero-card-accent .hero-card-label,
.hero-card-accent h3,
.hero-card-accent p {
    color: inherit;
}

.hero-card h3 {
    font-size: 1.15rem;
    margin-bottom: 6px;
}

.hero-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.hero-card-accent p {
    color: rgba(249, 250, 249, 0.88);
}

/* Main content */
main {
    flex: 1;
    width: min(1180px, 100%);
    margin: 0 auto;
}

/* Search box */
.search-box {
    background: var(--card-bg);
    padding: 24px;
    border: 1px solid rgba(198, 181, 162, 0.45);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

.search-input-wrapper {
    display: flex;
    gap: 12px;
}

#search-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(253, 103, 2, 0.15);
}

#search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background: var(--accent-color);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#search-btn:hover {
    background: var(--primary-light);
}

#search-btn:active {
    transform: scale(0.98);
}

#search-btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
}

.search-options {
    display: flex;
    gap: 24px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.search-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.search-options select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
}

.checkbox-label {
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Status messages */
.status {
    text-align: center;
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 8px;
    display: none;
}

.status.loading {
    display: block;
    background: #fff4ed;
    color: var(--accent-color);
}

.status.error {
    display: block;
    background: #fce4e6;
    color: var(--error-color);
}

.status.info {
    display: block;
    background: #fff4ed;
    color: #fd6702;
}

/* Results */
.results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 8px;
}

.results-header h2 {
    font-size: 1.2rem;
    color: var(--primary-color);
}

.results-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Result card */
.result-card {
    background: var(--card-bg);
    border: 1px solid rgba(198, 181, 162, 0.42);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.result-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.result-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #eb6c15, #fd6702 62%, #f58b42 100%);
    color: white;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.result-title a {
    color: white;
    text-decoration: none;
}

.result-title a:hover {
    text-decoration: underline;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    opacity: 0.9;
}

.result-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-body {
    padding: 16px 20px;
}

.result-text {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.7;
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.result-text.expanded {
    max-height: none;
}

.result-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, var(--card-bg));
    pointer-events: none;
}

.result-text.expanded::after {
    display: none;
}

.expand-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
    color: var(--accent-color);
    background: none;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.expand-btn:hover {
    background: var(--accent-color);
    color: white;
}

.result-footer {
    padding: 12px 20px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--success-color);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.result-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pdf-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: var(--accent-color);
    text-decoration: none;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    font-size: 0.85rem;
    transition: background 0.2s, color 0.2s;
}

.pdf-link:hover {
    background: var(--accent-color);
    color: white;
}

.doi-link {
    color: inherit;
    text-decoration: underline;
}

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

.metadata-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.metadata-toggle-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.metadata-toggle-btn.active {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

/* Metadata Details */
.metadata-details {
    padding: 16px 20px;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
}

.metadata-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.metadata-table tr {
    border-bottom: 1px solid var(--border-color);
}

.metadata-table tr:last-child {
    border-bottom: none;
}

.metadata-key {
    padding: 8px 12px 8px 0;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
    vertical-align: top;
    width: 30%;
}

.metadata-value {
    padding: 8px 0;
    color: var(--text-primary);
    word-break: break-word;
}

.metadata-link {
    color: var(--accent-color);
    text-decoration: none;
}

.metadata-link:hover {
    text-decoration: underline;
}

/* Footer */
footer {
    width: 100%;
    margin: 40px auto 0;
    padding: 0;
}

.footer-content {
    width: calc(100% - 4vw);
    margin-left: auto;
    margin-right: auto;
    padding: 28px 30px;
    border-radius: 30px;
    background:
        linear-gradient(135deg, rgba(255, 250, 242, 0.94) 0%, rgba(236, 244, 245, 0.9) 100%);
    border: 1px solid rgba(198, 181, 162, 0.45);
    box-shadow: var(--shadow);
}

.footer-mini-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.footer-mini-title {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.footer-mini-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-heading {
    margin-bottom: 32px;
}

.footer-kicker {
    color: var(--secondary-color);
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.footer-heading h2 {
    font-size: clamp(1.55rem, 2.8vw, 2.25rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    margin-bottom: 18px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.footer-block {
    padding: 18px 18px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(198, 181, 162, 0.36);
}

.footer-block-feature {
    padding: 20px 22px;
}

.footer-block h3 {
    font-size: 1.08rem;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.25;
}

.footer-label {
    color: var(--primary-color);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.footer-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.footer-content a {
    color: var(--accent-color);
    text-decoration: none;
}

.footer-content a:hover {
    text-decoration: underline;
}

.footer-block-feature {
    background: linear-gradient(135deg, rgba(26, 95, 116, 0.95), rgba(33, 111, 132, 0.88));
    border-color: rgba(26, 95, 116, 0.42);
}

.footer-block-feature .footer-label,
.footer-block-feature h3,
.footer-block-feature p,
.footer-block-feature a,
.footer-block-feature a:hover {
    color: #f9faf9;
}

.copyright {
    padding-top: 16px;
    border-top: 1px solid rgba(198, 181, 162, 0.46);
    font-size: 0.85rem !important;
    margin-top: 8px;
    text-align: left;
}

@media (min-width: 1100px) {
    .portal-hero {
        position: sticky;
        top: 18px;
        max-height: 84px;
        margin-bottom: 24px;
        padding: 18px 24px;
        overflow: hidden;
        z-index: 0;
        transition: max-height 0.28s ease, padding 0.28s ease, box-shadow 0.28s ease, transform 0.28s ease;
    }

    .portal-hero .hero-topbar {
        margin-bottom: 0;
    }

    .portal-hero .hero-mini-title {
        display: block;
    }

    .portal-hero .hero-grid,
    .portal-hero .header-nav {
        opacity: 0;
        pointer-events: none;
        transform: translateY(-10px);
        max-height: 0;
        overflow: hidden;
        margin: 0;
        transition: opacity 0.18s ease, transform 0.2s ease, max-height 0.28s ease;
    }

    .portal-hero:hover,
    .portal-hero:focus-within {
        max-height: 760px;
        padding: 28px 30px 24px;
        box-shadow: var(--shadow-lg);
    }

    .portal-hero:hover .hero-grid,
    .portal-hero:hover .header-nav,
    .portal-hero:focus-within .hero-grid,
    .portal-hero:focus-within .header-nav {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
        max-height: 1200px;
    }

    footer {
        position: relative;
        margin-top: 40px;
        z-index: 1;
    }

    .footer-content {
        max-height: 64px;
        padding: 18px 24px;
        overflow: hidden;
        transition: max-height 0.28s ease, padding 0.28s ease, box-shadow 0.28s ease;
    }

    .footer-mini-bar {
        display: flex;
    }

    .footer-heading,
    .footer-grid,
    .copyright {
        opacity: 0;
        pointer-events: none;
        transform: translateY(12px);
        max-height: 0;
        overflow: hidden;
        margin: 0;
        transition: opacity 0.18s ease, transform 0.2s ease, max-height 0.28s ease;
    }

    footer:hover .footer-content,
    footer:focus-within .footer-content {
        max-height: 540px;
        padding: 28px 30px;
        box-shadow: var(--shadow-lg);
    }

    footer:hover .footer-mini-bar,
    footer:focus-within .footer-mini-bar {
        margin-bottom: 18px;
    }

    footer:hover .footer-heading,
    footer:hover .footer-grid,
    footer:hover .copyright,
    footer:focus-within .footer-heading,
    footer:focus-within .footer-grid,
    footer:focus-within .copyright {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
        max-height: 1200px;
    }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 14px;
    }

    .portal-hero {
        padding: 20px 18px 18px;
        border-radius: 24px;
    }

    .hero-topbar,
    .hero-grid {
        grid-template-columns: 1fr;
        display: grid;
        gap: 18px;
    }

    .hero-topbar {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 18px;
    }

    header h1 {
        font-size: 2.2rem;
    }

    .hero-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-link {
        width: 100%;
    }

    .footer-content {
        padding: 22px 18px;
        border-radius: 24px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .copyright {
        text-align: center;
    }

    .search-input-wrapper {
        flex-direction: column;
    }

    .search-options {
        flex-direction: column;
        gap: 12px;
    }

    .result-meta {
        flex-direction: column;
        gap: 6px;
    }

    .result-footer {
        flex-direction: column;
        gap: 12px;
    }
}

/* Index Statistics */
.index-stats {
    background: var(--card-bg);
    border: 1px solid rgba(198, 181, 162, 0.45);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(180deg, rgba(255, 248, 238, 0.92), rgba(255, 255, 255, 0.7));
    border-radius: 18px;
    border: 1px solid rgba(198, 181, 162, 0.35);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--secondary-color), #2d809a);
    border-radius: 10px;
    color: white;
    flex-shrink: 0;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stats-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin: 0;
}

.stats-description strong {
    color: var(--primary-color);
}

.stats-actions {
    margin-top: 16px;
    text-align: left;
}

.browse-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--accent-color);
    background: transparent;
    border: 2px solid var(--accent-color);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
}

.browse-btn:hover {
    background: var(--accent-color);
    color: white;
}

/* Papers Section */
.papers-section {
    background: var(--card-bg);
    border: 1px solid rgba(198, 181, 162, 0.45);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    margin-bottom: 24px;
}

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

.papers-header h2 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin: 0;
}

.close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.close-btn:hover {
    background: var(--bg-color);
    color: var(--error-color);
}

.papers-filter {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.papers-filter input,
.papers-filter select {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.95rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
    background-color: var(--bg-main);
    color: var(--text-primary);
}

.papers-filter input:focus,
.papers-filter select:focus {
    border-color: var(--accent-color);
}

.papers-filter select {
    flex: 0 0 auto;
    min-width: 220px;
}

.papers-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
}

.papers-list {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.55);
}

.paper-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

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

.paper-item:hover {
    background: rgba(255, 245, 232, 0.8);
}

.paper-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.4;
}

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

.paper-meta span {
    margin-right: 12px;
}

.paper-doi {
    color: var(--accent-color);
    text-decoration: none;
}

.paper-doi:hover {
    text-decoration: underline;
}

.papers-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.pagination-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
    color: var(--accent-color);
    background: transparent;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--accent-color);
    color: white;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.repository-inventory-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.repository-inventory-export-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    color: var(--accent-color);
    background: transparent;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
}

.repository-inventory-export-link:hover {
    background: var(--accent-color);
    color: white;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-value {
        font-size: 1.25rem;
    }
}

/* No results */
.no-results {
    text-align: center;
    padding: 48px 24px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.no-results h3 {
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.no-results p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Navigation */
.header-nav {
    margin-top: 14px;
    display: flex;
    gap: 1rem;
    justify-content: flex-start;
    flex-wrap: wrap;
    padding: 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(198, 181, 162, 0.42);
}

.nav-link {
    padding: 0.8rem 1.4rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-radius: 999px;
    border-bottom: none;
    transition: all 0.2s;
    margin-bottom: 0;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(26, 95, 116, 0.08);
}

.nav-link.active {
    color: white;
    background: linear-gradient(135deg, var(--secondary-color), #226b82);
    box-shadow: 0 10px 20px rgba(26, 95, 116, 0.18);
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

/* MCP Guide Styles */
.mcp-guide {
    max-width: 900px;
    margin: 0 auto;
}

.mcp-guide h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.mcp-guide .intro {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.legal-notice-block {
    background: #fffdf5;
    border: 1px solid #e7dcc0;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.legal-notice-block p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.legal-notice-block p:last-of-type {
    margin-bottom: 0;
}

.legal-notice-block h3 {
    color: var(--text-primary);
    margin: 2rem 0 1rem;
    font-size: 1.35rem;
}

.legal-notice-block ul {
    margin: 0.35rem 0 1.15rem;
    padding-left: 2.25rem;
}

.legal-notice-block li {
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 0.45rem;
}

.legal-notice-block li:last-child {
    margin-bottom: 0;
}

.legal-notice-block a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

.legal-notice-block a:hover {
    color: var(--accent-color);
}

.mcp-status {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-badge {
    font-weight: 600;
    color: #2e7d32;
    font-size: 1rem;
}

.mcp-endpoint {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    color: #006c91;
    font-weight: 500;
}

/* MCP Tabs */
.mcp-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.mcp-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.mcp-tab:hover {
    color: var(--text-primary);
    background: rgba(0, 108, 145, 0.05);
}

.mcp-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.mcp-tab-content {
    display: none;
}

.mcp-tab-content.active {
    display: block;
}

.mcp-tab-content h3 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* Setup Steps */
.setup-steps {
    counter-reset: step-counter;
    list-style: none;
    padding: 0;
}

.setup-steps > li {
    counter-increment: step-counter;
    margin-bottom: 2rem;
    padding-left: 3rem;
    position: relative;
}

.setup-steps > li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

.setup-steps > li strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.setup-steps a {
    color: var(--accent-color);
    text-decoration: none;
}

.setup-steps a:hover {
    text-decoration: underline;
}

/* Credential Boxes */
.credential-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.credential-item {
    margin-bottom: 1rem;
}

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

.credential-item label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.credential-item code {
    display: inline-block;
    background: #f5f5f5;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #006c91;
    word-break: break-all;
    margin-right: 0.5rem;
}

.copy-btn {
    padding: 0.4rem 0.8rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #005a75;
}

.copy-btn.copied {
    background: #2e7d32;
}

/* Code Blocks */
.code-block {
    position: relative;
    margin-top: 1rem;
}

.code-block pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.copy-code-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.copy-code-btn.copied {
    background: #2e7d32;
    border-color: #2e7d32;
}

/* OS Paths */
.os-paths {
    list-style: none;
    padding: 0;
    margin-top: 0.5rem;
}

.os-paths li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

.os-paths code {
    background: #f5f5f5;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #006c91;
}

/* Info Boxes */
.mcp-info-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.info-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.info-box h4 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.info-box ul {
    list-style: none;
    padding: 0;
}

.info-box li {
    padding: 0.4rem 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

.info-box.troubleshooting {
    background: #fff8e1;
    border-color: #ffc107;
}

/* MCP Footer */
.mcp-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
}

.mcp-footer p {
    margin-bottom: 0.75rem;
}

.mcp-footer a {
    color: var(--accent-color);
    text-decoration: none;
}

.mcp-footer a:hover {
    text-decoration: underline;
}

.mcp-footer .tech-details {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .header-nav {
        flex-direction: column;
        gap: 8px;
        border-radius: 22px;
    }

    .nav-link {
        text-align: center;
        border-left: none;
    }

    .nav-link.active {
        border-left-color: transparent;
        border-bottom-color: transparent;
    }

    .mcp-status {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .mcp-tabs {
        flex-direction: column;
        gap: 0;
    }

    .mcp-tab {
        text-align: left;
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .mcp-tab.active {
        border-left-color: var(--accent-color);
        border-bottom-color: transparent;
    }

    .setup-steps > li {
        padding-left: 2.5rem;
    }

    .setup-steps > li::before {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 1rem;
    }

    .mcp-info-boxes {
        grid-template-columns: 1fr;
    }
}

/* Auth Section */
.auth-section {
    margin-top: 0;
    padding: 0.55rem 0.7rem;
    background: rgba(255, 255, 255, 0.56);
    border: 1px solid rgba(198, 181, 162, 0.42);
    border-radius: 999px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.auth-state {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.auth-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-color) 0%, #005a75 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 108, 145, 0.3);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 108, 145, 0.4);
}

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

.auth-btn-secondary {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(198, 181, 162, 0.66);
    border-radius: 999px;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.auth-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.7);
    border-color: var(--secondary-color);
}

.user-info {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .auth-section {
        width: 100%;
        justify-content: center;
    }
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0) 38%),
        linear-gradient(135deg, #f2efe6 0%, #d9e8ee 52%, #b9d5df 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s;
}

.login-overlay.hidden {
    display: none !important;
    opacity: 0;
    pointer-events: none;
}

.login-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    border: 1px solid rgba(27, 74, 97, 0.12);
    box-shadow: 0 22px 60px rgba(27, 74, 97, 0.18);
    backdrop-filter: blur(10px);
    padding: 3rem;
    max-width: 420px;
    width: 90%;
    animation: slideUp 0.4s ease-out;
}

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

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: auto;
    margin-bottom: 1rem;
}

.login-logo-eric {
    width: 140px;
    max-width: 100%;
    object-fit: contain;
}

.login-header h2 {
    color: var(--text-primary);
    margin: 0.5rem 0;
    font-size: 1.75rem;
}

.login-header p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
    font-size: 1rem;
}

.login-intro {
    margin-bottom: 1.5rem;
    padding: 1rem 1.1rem;
    background: #f5f9fb;
    border: 1px solid #d8e7ee;
    border-radius: 10px;
}

.login-intro p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.login-intro-note {
    margin-top: 0.5rem !important;
    color: var(--text-secondary) !important;
    font-size: 0.85rem !important;
}

.login-form {
    margin-bottom: 1.5rem;
}

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

.form-group label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(0, 108, 145, 0.1);
}

.form-group input::placeholder {
    color: #999;
}

.form-help {
    margin: 0.45rem 0 0;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.4;
}

.login-error {
    background: #ffebee;
    color: #c62828;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border-left: 4px solid #c62828;
}

.login-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--accent-color) 0%, #005a75 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 108, 145, 0.3);
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 108, 145, 0.4);
}

.login-btn:active:not(:disabled) {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-btn-spinner {
    display: inline-block;
}

.login-footer {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

.login-hint {
    font-size: 0.85rem !important;
    color: #999 !important;
}

@media (max-width: 768px) {
    .login-container {
        padding: 2rem;
        width: 95%;
    }
    
    .login-header h2 {
        font-size: 1.5rem;
    }
}

/* ==========================================
   CHAT SECTION STYLES
   ========================================== */

.chat-container {
    display: flex;
    flex-direction: column;
    width: 980px;
    max-width: none;
    min-width: 280px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 2;
    height: calc(100vh - 280px);
    min-height: 400px;
    max-height: 90vh;
    background: var(--card-bg);
    border: 1px solid rgba(198, 181, 162, 0.42);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow: auto;
    resize: none;
}

.chat-resize-handle {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    z-index: 8;
    opacity: 0.6;
    border-right: 2px solid #b8b8b8;
    border-bottom: 2px solid #b8b8b8;
    border-radius: 0 0 4px 0;
}

.chat-resize-handle:hover {
    opacity: 1;
    border-right-color: #8a8a8a;
    border-bottom-color: #8a8a8a;
}

body.chat-resizing-active {
    user-select: none;
    cursor: nwse-resize;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #226b82 100%);
    color: white;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sara-logo-chat {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    padding: 2px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
    flex: 0 0 auto;
}

.chat-title h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.sara-subtitle {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.85;
}

.chat-model-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
}

.chat-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.chat-action-btn.active {
    background: rgba(255, 255, 255, 0.3);
}

/* Stats Panel */
.chat-stats-panel {
    background: linear-gradient(180deg, rgba(255, 251, 245, 0.96) 0%, rgba(243, 247, 248, 0.96) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
}

.gpu-bar-section {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 0.4rem;
}

.gpu-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gpu-bar-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.gpu-bar-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.gpu-bar-track {
    width: 100%;
    height: 10px;
    background: #dde8ea;
    border-radius: 5px;
    overflow: visible;
    position: relative;
}

.gpu-bar-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
    background-size: 300% 100%;
    transition: width 0.4s ease, background-position 0.4s ease;
    max-width: 100%;
}

.gpu-bar-peak {
    position: absolute;
    top: -1px;
    width: 2px;
    height: 12px;
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.4);
    border-radius: 1px;
    transition: left 0.4s ease;
    pointer-events: none;
}

.gpu-bar-details {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.gpu-detail {
    font-size: 0.78rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.gpu-detail-label {
    color: var(--text-secondary);
}

.stats-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.stats-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Welcome Screen */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    text-align: left;
    padding: 2.5rem 1rem;
    color: var(--text-secondary);
}

.chat-welcome-main {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 1.75rem;
    align-items: start;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 1.8rem 1.9rem;
    background: linear-gradient(135deg, rgba(255, 251, 245, 0.96) 0%, rgba(239, 245, 246, 0.94) 100%);
    border: 1px solid rgba(198, 181, 162, 0.4);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.chat-welcome-content {
    min-width: 0;
}

.welcome-icon {
    color: var(--primary-color);
    opacity: 0.9;
    margin-bottom: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.sara-welcome-logo {
    width: 124px;
    height: 124px;
    display: block;
    padding: 10px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(198, 181, 162, 0.38);
    box-shadow: 0 12px 24px rgba(34, 29, 24, 0.08);
}

.chat-welcome h3 {
    color: var(--text-primary);
    margin-bottom: 0.6rem;
    font-size: 1.85rem;
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.chat-welcome p {
    max-width: none;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.welcome-stats {
    list-style: none;
    padding: 0;
    margin: 0 0 0.75rem 0;
    text-align: left;
    max-width: none;
}

.welcome-stats li {
    padding: 0.3rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.welcome-stats li::before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    margin-right: 0.5rem;
}

.welcome-stats strong {
    color: var(--primary-color);
}

.welcome-growing {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 1rem !important;
}

.share-search-hint {
    background: linear-gradient(135deg, rgba(248, 244, 236, 0.98) 0%, rgba(239, 245, 246, 0.96) 100%);
    border: 1px solid rgba(198, 181, 162, 0.42);
    border-radius: 18px;
    padding: 1rem 1.1rem;
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
    color: var(--secondary-color);
    max-width: none;
}

.share-search-hint p {
    margin: 0.45rem 0 0;
}

.share-search-hint-list {
    margin: 0.6rem 0 0;
    padding-left: 1.2rem;
}

.share-search-hint-list li {
    margin-bottom: 0.35rem;
}

.share-search-hint-list li:last-child {
    margin-bottom: 0;
}

.share-search-hint-note {
    margin-top: 0.75rem !important;
}

.share-search-hint code {
    background: rgba(255, 255, 255, 0.86);
    padding: 0.18rem 0.42rem;
    border-radius: 8px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.8rem;
    color: var(--secondary-color);
    border: 1px solid rgba(198, 181, 162, 0.38);
}

.sara-disclaimer {
    background: linear-gradient(135deg, rgba(255, 248, 236, 0.98) 0%, rgba(255, 252, 245, 0.98) 100%);
    border: 1px solid rgba(198, 181, 162, 0.42);
    border-left: 4px solid var(--primary-color);
    border-radius: 18px;
    padding: 0.95rem 1.1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    max-width: none;
}

.sara-disclaimer strong {
    color: var(--text-primary);
}

.welcome-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
    margin-top: 0.4rem;
}

.suggestion-btn {
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(198, 181, 162, 0.44);
    color: var(--text-primary);
    padding: 0.58rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 18px rgba(34, 29, 24, 0.05);
}

.suggestion-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* SADA recording notice */
.sada-recording-notice {
    background: linear-gradient(135deg, rgba(240, 246, 247, 0.98) 0%, rgba(247, 250, 250, 0.98) 100%);
    border: 1px solid rgba(198, 181, 162, 0.42);
    border-left: 4px solid var(--secondary-color);
    border-radius: 18px;
    padding: 0.95rem 1.1rem;
    margin-bottom: 1.5rem;
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
}
.sada-recording-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--secondary-color);
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.sada-recording-notice strong {
    color: var(--text-primary);
}
.sada-recording-notice em {
    font-style: italic;
    color: var(--secondary-color);
}

/* Rating buttons */
.rating-buttons {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.7rem;
    padding-top: 0.5rem;
    border-top: 1px solid #eee;
}
.rating-label {
    font-size: 0.82rem;
    color: #555;
    margin-right: 0.3rem;
    font-weight: 500;
}
.rating-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 3px 8px;
    cursor: pointer;
    color: #888;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s;
}
.rating-btn:hover {
    border-color: #aaa;
    color: #555;
    background: #f5f5f5;
}
.rating-btn.active.thumbs-up {
    border-color: #2f855a;
    color: #2f855a;
    background: #f0fff4;
}
.rating-btn.active.thumbs-down {
    border-color: #c53030;
    color: #c53030;
    background: #fff5f5;
}

/* Negative feedback detail panel */
.feedback-detail-panel {
    margin-top: 0.6rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #fff8f0 0%, #fff5f5 100%);
    border: 1px solid #e8c4b8;
    border-radius: 8px;
    width: 100%;
}
.feedback-detail-header {
    font-size: 0.82rem;
    font-weight: 600;
    color: #744210;
    margin-bottom: 0.5rem;
}
.feedback-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.9rem;
    margin-bottom: 0.5rem;
}
.feedback-cat {
    font-size: 0.78rem;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
.feedback-cat input[type="checkbox"] {
    accent-color: #c53030;
    width: 14px;
    height: 14px;
}
.feedback-text {
    width: 100%;
    font-size: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 0.5rem;
    box-sizing: border-box;
}
.feedback-text:focus {
    outline: none;
    border-color: #c53030;
    box-shadow: 0 0 0 2px rgba(197,48,48,0.1);
}
.feedback-submit-btn {
    background: #c53030;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.15s;
}
.feedback-submit-btn:hover {
    background: #9b2c2c;
}
.feedback-thanks {
    font-size: 0.82rem;
    color: #744210;
    font-weight: 500;
    padding: 0.2rem 0;
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 0.75rem;
    max-width: 92%;
    animation: fadeIn 0.3s ease-out;
}

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

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.chat-message.user .message-avatar {
    background: var(--primary-color);
    color: white;
}

.chat-message.assistant .message-avatar {
    background: rgba(26, 95, 116, 0.12);
    color: var(--secondary-color);
}

.message-content {
    padding: 0.875rem 1.125rem;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.chat-message.user .message-content {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
    background: linear-gradient(135deg, rgba(255, 251, 245, 0.96) 0%, rgba(241, 246, 247, 0.96) 100%);
    border: 1px solid rgba(198, 181, 162, 0.4);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    position: relative;
}

/* AI disclaimer info icon */
.ai-disclaimer-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    color: #4a90d9;
    cursor: help;
    opacity: 0.55;
    transition: opacity 0.2s;
    vertical-align: middle;
}
.ai-disclaimer-icon:hover {
    opacity: 1;
    color: #2b6cb0;
}
.ai-disclaimer-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    width: 280px;
    padding: 8px 10px;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.78rem;
    line-height: 1.4;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    z-index: 9999;
    pointer-events: none;
}
.ai-disclaimer-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 4px;
    border: 6px solid transparent;
    border-top-color: #1a1a1a;
}
.ai-disclaimer-icon:hover .ai-disclaimer-tooltip {
    display: block;
}

.message-content p {
    margin: 0 0 0.75rem 0;
}

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

.message-content h3,
.message-content h4,
.message-content h5 {
    margin: 1rem 0 0.55rem;
    line-height: 1.3;
}

.message-content h3:first-child,
.message-content h4:first-child,
.message-content h5:first-child {
    margin-top: 0;
}

.message-content ul,
.message-content ol {
    margin: 0.65rem 0 0.9rem 1.2rem;
    padding-left: 0.2rem;
}

.message-content li {
    margin: 0.25rem 0;
}

.message-content hr {
    border: 0;
    border-top: 1px solid rgba(0, 0, 0, 0.18);
    margin: 1rem 0;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.75rem 0;
    font-size: 0.875em;
    overflow-x: auto;
    display: block;
}

.message-content table thead th {
    background: rgba(0, 0, 0, 0.06);
    font-weight: 600;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid rgba(0, 0, 0, 0.15);
}

.message-content table td {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.message-content table tbody tr:hover {
    background: rgba(0, 0, 0, 0.03);
}

.message-content .chat-inline-image {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0.5rem 0;
    display: block;
    border: 1px solid rgba(0, 0, 0, 0.12);
    cursor: pointer;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.875em;
}

.message-content pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.75rem 0;
}

.message-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.5rem 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Status Message */
.status-message {
    color: #666;
    font-style: italic;
    font-size: 0.9rem;
}

/* Thinking / Working Panel */
.thinking-panel {
    margin-bottom: 0.45rem;
    padding: 0.45rem 0.6rem;
    border: 1px solid rgba(26, 95, 116, 0.28);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(232, 243, 245, 0.98) 0%, rgba(241, 248, 249, 0.98) 100%);
    transition: background 0.2s ease;
}

.thinking-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 0;
    padding: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #215b6c;
    margin-bottom: 0.25rem;
}

.thinking-chevron {
    font-size: 0.74rem;
    line-height: 1;
    color: #4f7680;
}

.thinking-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* Sub-panel for each stream (WORKING / THINKING) */
.thinking-stream {
    border: 1px solid rgba(26, 95, 116, 0.18);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.84);
    padding: 0.28rem 0.4rem;
}

.thinking-stream-label {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #2c6677;
    margin-bottom: 0.15rem;
}

.thinking-stream-content {
    font-size: 0.81rem;
    line-height: 1.4;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 180px;
    overflow-y: auto;
}

.thinking-panel.collapsed .thinking-header {
    margin-bottom: 0;
}

.thinking-panel.collapsed .thinking-body {
    display: none;
}

.thinking-panel.collapsed {
    background: linear-gradient(180deg, rgba(234, 244, 246, 0.98) 0%, rgba(240, 247, 248, 0.98) 100%);
}

/* Context usage bar (inside thinking panel) */
.ctx-bar-wrapper {
    margin-top: 0.35rem;
    padding: 0 0.1rem;
}

.ctx-bar-outer {
    height: 7px;
    background: #e2e8e9;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.ctx-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease, background 0.3s ease;
    min-width: 2px;
}

.ctx-bar-fill.level-ok       { background: #5ba85b; }
.ctx-bar-fill.level-info     { background: #2f7b90; }
.ctx-bar-fill.level-warning  { background: #e6a817; }
.ctx-bar-fill.level-critical { background: #d9534f; }

.ctx-bar-label {
    font-size: 0.62rem;
    color: #76848d;
    margin-top: 1px;
    text-align: right;
    letter-spacing: 0.01em;
}

/* Tool Activity Panel */
.tool-activity-panel {
    margin-bottom: 0.45rem;
    padding: 0.4rem 0.55rem;
    border: 1px solid rgba(26, 95, 116, 0.26);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(231, 242, 244, 0.98) 0%, rgba(239, 247, 248, 0.98) 100%);
    width: 100%;
}
.tool-activity-header {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    gap: 0.3rem;
}
.tool-activity-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #215b6c;
}
.tool-activity-count {
    font-weight: 400;
    color: var(--text-secondary);
}
.tool-activity-chevron {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.15s;
}
.tool-activity-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.35rem;
}
.tool-activity-panel.collapsed .tool-activity-body { display: none; }
.tool-activity-panel.collapsed {
    background: linear-gradient(180deg, rgba(234, 244, 246, 0.98) 0%, rgba(238, 246, 247, 0.98) 100%);
}
.tool-activity-panel.collapsed .tool-activity-chevron {
    transform: rotate(-90deg);
}

/* Individual tool entry */
.tool-entry {
    border: 1px solid rgba(26, 95, 116, 0.16);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.88);
    overflow: hidden;
}
.tool-entry[data-state="running"] {
    border-color: rgba(26, 95, 116, 0.34);
}
.tool-entry-header {
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.45rem;
    font-family: inherit;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-primary);
}
.tool-entry-header:hover {
    background: rgba(231, 242, 244, 0.72);
}
.tool-entry-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
}
.tool-entry-name {
    font-weight: 600;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.74rem;
}
.tool-entry-status {
    margin-left: auto;
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
}
.tool-entry-status.running { color: #2a6f82; }
.tool-entry-status.done { color: #2f855a; }
.tool-entry-status.error { color: #c53030; }
.tool-entry-chevron {
    font-size: 0.65rem;
    color: #8a969f;
    flex-shrink: 0;
}

/* Tool entry body */
.tool-entry-body {
    padding: 0 0.45rem 0.35rem;
}
.tool-entry-section {
    margin-top: 0.25rem;
}
.tool-entry-section-label {
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}
.tool-entry-code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.73rem;
    line-height: 1.4;
    color: var(--text-primary);
    background: #edf5f6;
    border: 1px solid rgba(26, 95, 116, 0.16);
    border-radius: 4px;
    padding: 0.3rem 0.45rem;
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 300px;
    overflow-y: auto;
}
.tool-error-text {
    color: #c53030;
    background: #fff5f5;
    border-color: #feb2b2;
}

.answer-content {
    min-height: 1.1rem;
}

/* Verification Panel */
.verification-panel {
    margin-top: 0.65rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid rgba(26, 95, 116, 0.24);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(232, 243, 245, 0.98) 0%, rgba(241, 248, 249, 0.98) 100%);
}

.verification-header {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #215b6c;
    margin-bottom: 0.35rem;
}

.verification-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.verification-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.verification-badge.supported {
    background: #e9f8ed;
    color: #1b7f3b;
}

.verification-badge.contradicted {
    background: #fdebec;
    color: #b42318;
}

.verification-badge.unclear {
    background: #fff4e6;
    color: #b54708;
}

.verification-meta {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.verification-note {
    margin-top: 0.35rem;
    font-size: 0.78rem;
}

.verification-note.warn {
    color: #8f5b12;
}

.verification-note.error {
    color: #b42318;
}

.verification-inline {
    border-radius: 3px;
    padding: 0 1px;
}

.verification-inline.supported {
    background: rgba(45, 138, 73, 0.16);
}

.verification-inline.contradicted {
    background: rgba(180, 35, 24, 0.18);
}

.verification-inline.unclear {
    background: rgba(181, 71, 8, 0.16);
}

.verification-flagged {
    margin-top: 0.625rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.verification-flagged-header {
    font-size: 0.78rem;
    font-weight: 600;
    color: #9f2f24;
    margin-bottom: 0.375rem;
}

.verification-flagged-item {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.4;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
    border-left: 2px solid #b42318;
    background: rgba(180, 35, 24, 0.05);
    border-radius: 0 3px 3px 0;
}

/* SADA Analysis Validation Panel */
.validation-panel {
    margin-top: 0.65rem;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    font-size: 0.82rem;
    line-height: 1.45;
}

.validation-panel.correct {
    border: 1px solid #c3e6cb;
    background: #f0faf3;
    color: #1b7f3b;
}

.validation-panel.issues {
    border: 1px solid #f5d6a8;
    background: #fffbf0;
    color: #7a4510;
}

.validation-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
}

.validation-panel.correct .validation-header { color: #1b7f3b; }
.validation-panel.issues .validation-header { color: #b54708; }

.validation-chevron {
    font-size: 0.74rem;
    line-height: 1;
    margin-left: auto;
}

.validation-body {
    margin-top: 0.35rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.validation-panel.collapsed .validation-body { display: none; }
.validation-panel.collapsed { opacity: 0.85; }

/* Input Area */
.chat-input-container {
    padding: 1rem 1.5rem;
    background: linear-gradient(180deg, rgba(255, 251, 245, 0.96) 0%, rgba(243, 247, 248, 0.96) 100%);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

#chat-input,
#data-chat-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 0.95rem;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    line-height: 1.4;
    transition: border-color 0.2s;
}

#chat-input:focus,
#data-chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

#chat-input::placeholder,
#data-chat-input::placeholder {
    color: #999;
}

.chat-send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    background: var(--accent-deep);
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #c7c0b9;
    cursor: not-allowed;
}

.chat-send-btn.streaming {
    background: #dc2626;
    cursor: pointer;
    animation: pulse-stop 2s infinite;
}

.chat-send-btn.streaming:hover {
    background: #991b1b;
    transform: scale(1.05);
}

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

.chat-input-hint {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

@media (max-width: 1040px) {
    .chat-container {
        width: calc(100vw - 40px);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        min-width: 0;
        height: calc(100vh - 300px);
        min-height: 400px;
        border-radius: 0;
        resize: none;
    }

    .chat-resize-handle {
        display: none;
    }

    .chat-header {
        padding: 0.875rem 1rem;
    }

    .chat-title h2 {
        font-size: 1.1rem;
    }

    .chat-messages {
        padding: 1rem;
    }

    .chat-message {
        max-width: 90%;
    }

    .chat-welcome {
        padding: 2rem 0.5rem;
        text-align: center;
    }

    .chat-welcome-main {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .chat-welcome-content {
        text-align: center;
    }

    .welcome-icon {
        justify-content: center;
    }

    .sara-welcome-logo {
        width: 88px;
        height: 88px;
    }

    .welcome-stats {
        text-align: left;
    }

    .welcome-suggestions {
        flex-direction: column;
        justify-content: center;
    }

    .suggestion-btn {
        width: 100%;
    }

    .chat-input-container {
        padding: 0.75rem 1rem;
    }
}

/* LlamaIndex Toggle Button */
.stats-row-action {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.llamaindex-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.llamaindex-toggle-btn.active {
    background: #dcfce7;
    color: #166534;
}

.llamaindex-toggle-btn.active:hover {
    background: #bbf7d0;
}

.llamaindex-toggle-btn.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.llamaindex-toggle-btn.inactive:hover {
    background: #fecaca;
}

.llamaindex-toggle-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}

.llamaindex-toggle-btn .toggle-status {
    font-weight: 600;
}

.llamaindex-toggle-btn .toggle-hint {
    font-weight: 400;
    opacity: 0.8;
}


/* =====================================================================
   Router — Routing badge, Disambiguation, Welcome capabilities
   ===================================================================== */

/* Routing badge on assistant messages */
.routing-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    line-height: 1;
    text-transform: uppercase;
}

.routing-badge-sara {
    background: linear-gradient(135deg, #fff0e6 0%, #ffe8d6 100%);
    color: #c05600;
    border: 1px solid #f0c8a0;
}

.routing-badge-sada {
    background: linear-gradient(135deg, #e8f5e9 0%, #e0f2e1 100%);
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* Queued notice */
.queued-notice {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    background: rgba(255, 247, 225, 0.98);
    border: 1px solid rgba(240, 215, 122, 0.9);
    color: #8d6e00;
    font-size: 0.82rem;
    animation: fadeInNotice 0.3s ease;
}
.queued-icon {
    font-size: 0.95rem;
}
@keyframes fadeInNotice {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Disambiguation card */
.disambiguation-card {
    padding: 0.25rem 0;
}

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

.disambiguation-buttons {
    display: flex;
    gap: 0.75rem;
}

.disambiguation-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.75rem 1.25rem;
    border-radius: 12px;
    border: 2px solid rgba(198, 181, 162, 0.44);
    background: linear-gradient(135deg, rgba(255, 251, 245, 0.98) 0%, rgba(241, 246, 247, 0.96) 100%);
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    max-width: 200px;
}

.disambiguation-btn:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(253, 103, 2, 0.15);
    transform: translateY(-1px);
}

.disambiguation-btn.sara-btn:hover {
    border-color: #e57300;
    background: #fff8f3;
}

.disambiguation-btn.sada-btn:hover {
    border-color: #2e7d32;
    background: #f5fbf5;
}

.disambiguation-logo {
    width: 36px;
    height: 36px;
}

.disambiguation-btn-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.disambiguation-btn-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Welcome capabilities (SARA + SADA side by side) */
.welcome-capabilities {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.welcome-capability {
    background: linear-gradient(135deg, rgba(255, 251, 245, 0.94) 0%, rgba(245, 249, 249, 0.9) 100%);
    border: 1px solid rgba(198, 181, 162, 0.4);
    border-radius: 20px;
    padding: 1rem 1.05rem;
    box-shadow: 0 10px 22px rgba(34, 29, 24, 0.05);
}

.capability-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.7rem;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.capability-logo {
    width: 24px;
    height: 24px;
}

.capability-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.84rem;
    color: var(--text-secondary);
}

.capability-list li {
    padding: 0.2rem 0;
    line-height: 1.45;
}

.capability-list li::before {
    content: "\2022";
    color: var(--secondary-color);
    font-weight: bold;
    margin-right: 0.4rem;
}

.capability-list strong {
    color: var(--primary-color);
}

/* Responsive: stack capabilities on small screens */
@media (max-width: 600px) {
    .chat-welcome {
        padding: 1.5rem 0.2rem;
    }

    .chat-welcome-main {
        grid-template-columns: 1fr;
        padding: 1.25rem 1rem;
        gap: 1rem;
    }

    .welcome-icon {
        justify-content: flex-start;
    }

    .welcome-capabilities {
        grid-template-columns: 1fr;
    }
    .disambiguation-buttons {
        flex-direction: column;
    }
    .disambiguation-btn {
        max-width: none;
    }
}
