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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --bg-elevated: #e9ecef;
    --accent-primary: #fbbf24;
    --accent-secondary: #f59e0b;
    --accent-tertiary: #d97706;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #d1d5db;
    --border-subtle: #e5e7eb;
    --success: #10b981;
    --warning: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 14px;
}

#app {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 24px;
}

/* Landing Page */
.landing-container {
    text-align: center;
    padding: 60px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.landing-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--accent-tertiary);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    margin-bottom: 24px;
    text-transform: uppercase;
}

.landing-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #1f2937 0%, #4b5563 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.landing-subtitle {
    font-size: 18px;
    margin-bottom: 24px;
    color: var(--text-secondary);
    font-weight: 500;
}

.landing-description {
    font-size: 15px;
    margin-bottom: 48px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin: 48px 0;
    text-align: left;
}

.feature-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 24px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.feature-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(245, 158, 11, 0.15) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-tertiary);
    margin-bottom: 16px;
}

.feature-card h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.feature-card p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Info Sections */
.info-sections {
    margin: 48px 0;
    text-align: left;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.info-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    padding: 28px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    margin-bottom: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.info-section:hover {
    transform: translateY(-2px);
    border-color: var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.info-section h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-section h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 2px;
}

.info-section p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

.rate-limit-notice {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1) 0%, rgba(245, 158, 11, 0.1) 100%);
    padding: 20px 24px;
    border-radius: 10px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    margin-bottom: 20px;
}

.rate-limit-notice p {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
}

.rate-limit-notice strong {
    font-weight: 600;
    color: var(--accent-tertiary);
}

.primary-button {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: #1f2937;
    border: none;
    padding: 14px 32px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.4);
}

/* Query Interface */
.query-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.3px;
}

.stats-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

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

hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 20px 0;
}

/* Suggestions */
#suggestions-container {
    margin-bottom: 16px;
}

.suggestions-toggle {
    width: 100%;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.suggestions-toggle:hover {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
    border-color: var(--border-color);
}

.toggle-icon {
    transition: transform 0.2s ease;
}

.suggestions-toggle.expanded .toggle-icon {
    transform: rotate(180deg);
}

.suggestions-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.suggestions-content.expanded {
    max-height: 500px;
    margin-top: 12px;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
}

.suggestion-btn {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    font-size: 13px;
    line-height: 1.5;
}

.suggestion-btn:hover {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    margin-bottom: 16px;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border-subtle);
}

.message.user {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08) 0%, rgba(245, 158, 11, 0.08) 100%);
    border-color: rgba(251, 191, 36, 0.2);
}

.message-avatar {
    font-size: 18px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.message-content {
    flex: 1;
}

.message-text {
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Markdown styling for assistant messages */
.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

.message-text h1 { font-size: 20px; }
.message-text h2 { font-size: 18px; }
.message-text h3 { font-size: 16px; }
.message-text h4 { font-size: 15px; }
.message-text h5 { font-size: 14px; }
.message-text h6 { font-size: 13px; }

.message-text h1:first-child,
.message-text h2:first-child,
.message-text h3:first-child,
.message-text h4:first-child,
.message-text h5:first-child,
.message-text h6:first-child {
    margin-top: 0;
}

.message-text p {
    margin-bottom: 12px;
}

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

.message-text ul,
.message-text ol {
    margin: 8px 0 12px 20px;
    padding-left: 4px;
}

.message-text li {
    margin-bottom: 4px;
}

.message-text li:last-child {
    margin-bottom: 0;
}

.message-text code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: #c7254e;
}

.message-text pre {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0 12px 0;
    overflow-x: auto;
}

.message-text pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: var(--text-primary);
    font-size: 12px;
    line-height: 1.5;
}

.message-text blockquote {
    border-left: 3px solid var(--accent-primary);
    padding-left: 12px;
    margin: 8px 0 12px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.message-text a {
    color: var(--accent-tertiary);
    text-decoration: underline;
    transition: color 0.2s ease;
}

.message-text a:hover {
    color: var(--accent-secondary);
}

.message-text strong {
    font-weight: 600;
    color: var(--text-primary);
}

.message-text em {
    font-style: italic;
}

.message-text hr {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 12px 0;
}

.message-text table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0 12px 0;
}

.message-text table th,
.message-text table td {
    border: 1px solid var(--border-subtle);
    padding: 8px 12px;
    text-align: left;
}

.message-text table th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.message-text table tr:nth-child(even) {
    background: var(--bg-secondary);
}

.message-text img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
}


.citations-container {
    margin-top: 12px;
}

.citations-toggle {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: #1f2937;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.citations-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.citation-chevron {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.citations-content {
    display: none;
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    border-left: 3px solid var(--accent-primary);
}

.citations-content.expanded {
    display: block;
}

.citation {
    margin-bottom: 8px;
}

.citation:last-child {
    margin-bottom: 0;
}

.citation-item-toggle {
    width: 100%;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.citation-item-toggle:hover {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
    border-color: var(--accent-primary);
}

.citation-item-chevron {
    font-size: 9px;
    transition: transform 0.2s ease;
    opacity: 0.7;
}

.citation-text-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.citation-text-container.expanded {
    max-height: 600px;
    margin-top: 8px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border: 1px solid var(--border-subtle);
}

.citation-page-link {
    margin-bottom: 8px;
    font-size: 11px;
}

.citation-page-link a {
    color: #92400e;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.citation-page-link a:hover {
    color: #78350f;
    text-decoration: underline;
}

.citation-text {
    color: var(--text-secondary);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px;
    white-space: pre-wrap;
    line-height: 1.6;
    word-wrap: break-word;
}

.citation-text strong {
    font-weight: 700;
    color: var(--text-primary);
    background-color: rgba(251, 191, 36, 0.15);
    padding: 1px 2px;
    border-radius: 2px;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 16px 0;
    border-top: 1px solid var(--border-subtle);
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
}

#chat-input::placeholder {
    color: var(--text-muted);
}

#chat-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.1);
}

#chat-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-button {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: #1f2937;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.send-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

.send-button:disabled {
    background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--bg-elevated) 100%);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Loading Spinner */
#loading-spinner {
    padding: 16px 0;
    margin-bottom: 16px;
}

.spinner {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
}

.spinner-icon {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-divider {
    opacity: 0.5;
}

/* Scrollbar */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    #app {
        padding: 16px;
    }

    .landing-title {
        font-size: 32px;
    }

    .landing-subtitle {
        font-size: 16px;
    }

    .landing-description {
        font-size: 14px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .info-sections {
        margin: 32px 0;
    }

    .info-section {
        padding: 20px;
    }

    .info-section h3 {
        font-size: 16px;
    }

    .info-section p {
        font-size: 13px;
    }

    .rate-limit-notice {
        padding: 16px 20px;
    }

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

    .stats-row {
        flex-direction: column;
        gap: 8px;
    }

    .stat {
        min-width: auto;
    }

    .header h1 {
        font-size: 20px;
    }

    .message {
        padding: 12px;
        gap: 10px;
    }

    .message-avatar {
        font-size: 16px;
        min-width: 28px;
        height: 28px;
    }
}

/* Year Filter Section */
/* Year Filter - Simple inline design */
.year-filter-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 8px 0;
}

.year-filter-inline label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.year-filter-inline select {
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.year-filter-inline select:hover {
    border-color: var(--accent-secondary);
    background: var(--bg-secondary);
}

.year-filter-inline select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.1);
}

.year-separator {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* Filing Period Badge in Citations */
.filing-period {
    display: inline-block;
    background: var(--accent-primary);
    color: var(--text-primary);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-right: 8px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .year-filter-inline {
        flex-wrap: wrap;
        gap: 8px;
    }
