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

html,
body {
    max-width: 100vw;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #f5f5f5;
    color: #333;
}

.navbar {
    background-color: #2563eb;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}

.nav-link:hover {
    opacity: 0.8;
}

.main-content {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.container {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #2563eb;
}

.search-button {
    padding: 0.75rem 2rem;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-button:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.search-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.results-container {
    margin-top: 2rem;
}

.results-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1f2937;
}

.result-item {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s;
}

.result-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-matches {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.match-snippet {
    padding: 0.75rem;
    background-color: #f9fafb;
    border-radius: 4px;
    border-left: 3px solid #93c5fd;
}

.match-meta {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    display: block;
    margin-bottom: 0.375rem;
}

.match-content {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.doc-result-item {
    padding: 1.5rem;
    display: block;
    text-decoration: none;
    color: inherit;
}

.doc-result-item:hover .result-doc-name {
    text-decoration: underline;
}

.result-doc {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.result-doc-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1e40af;
}

.result-doc-description {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
}

.result-doc-name {
    font-weight: 600;
    color: #2563eb;
}

.result-doc-pages {
    font-size: 0.75rem;
    color: #9ca3af;
}

.result-doc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.25rem;
}

.result-doc-tag {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.result-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.result-score {
    background-color: #dbeafe;
    color: #1e40af;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-weight: 500;
}

.search-signals {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background-color: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.search-timings {
    margin-bottom: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: #64748b;
}

.search-timings .timing-badge {
    display: inline-block;
    margin: 0.2rem 0.4rem 0.2rem 0;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background-color: #f1f5f9;
    font-family: ui-monospace, monospace;
}

.search-timings .timing-total {
    font-weight: 600;
    background-color: #e2e8f0;
}

.signals-section {
    margin-bottom: 0.5rem;
}

.signals-section:last-child {
    margin-bottom: 0;
}

.signal-badge {
    display: inline-block;
    margin: 0.2rem 0.4rem 0.2rem 0;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.cue-badge {
    background-color: #e0e7ff;
    color: #3730a3;
}

.regex-badge {
    background-color: #fef3c7;
    color: #92400e;
    font-family: ui-monospace, monospace;
}

.desc-matched-badge {
    background-color: #d1fae5;
    color: #065f46;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.tags-badge {
    color: #6b7280;
    font-size: 0.8rem;
}

.matched-memories {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.memories-group strong {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.memory-snippet {
    font-size: 0.8rem;
    color: #4b5563;
    padding: 0.5rem;
    background-color: #f9fafb;
    border-radius: 4px;
}

.context-snippet {
    border-left: 3px solid #93c5fd;
}

.fact-snippet {
    border-left: 3px solid #86efac;
}

.result-content {
    color: #374151;
    line-height: 1.6;
    margin-top: 0.5rem;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    color: #6b7280;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 0.9375rem;
}

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

.htmx-indicator {
    display: none;
}

.htmx-indicator.htmx-request {
    display: flex;
}

.error {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    max-height: 800px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.message {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

.message-user {
    align-items: flex-end;
}

.message-assistant {
    align-items: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    word-wrap: break-word;
}

.message-user .message-content {
    background-color: #2563eb;
    color: white;
}

.message-assistant .message-content {
    background-color: white;
    color: #333;
    border: 1px solid #e5e7eb;
}

/* Markdown styling in assistant messages */
.message-assistant .message-content p {
    margin: 0 0 0.5em 0;
}
.message-assistant .message-content p:last-child {
    margin-bottom: 0;
}
.message-assistant .message-content strong {
    font-weight: 600;
}
.message-assistant .message-content em {
    font-style: italic;
}
.message-assistant .message-content code {
    background-color: #f3f4f6;
    padding: 0.125em 0.375em;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: ui-monospace, 'Cascadia Code', monospace;
}
.message-assistant .message-content pre {
    margin: 0.5em 0;
    padding: 0.75rem;
    background-color: #f3f4f6;
    border-radius: 6px;
    overflow-x: auto;
}
.message-assistant .message-content pre code {
    background: none;
    padding: 0;
}
.message-assistant .message-content ul,
.message-assistant .message-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}
.message-assistant .message-content li {
    margin: 0.25em 0;
}
.message-assistant .message-content h1,
.message-assistant .message-content h2,
.message-assistant .message-content h3 {
    margin: 0.75em 0 0.5em 0;
    font-weight: 600;
}
.message-assistant .message-content h1:first-child,
.message-assistant .message-content h2:first-child,
.message-assistant .message-content h3:first-child {
    margin-top: 0;
}
.message-assistant .message-content h1 { font-size: 1.25em; }
.message-assistant .message-content h2 { font-size: 1.1em; }
.message-assistant .message-content h3 { font-size: 1em; }
.message-assistant .message-content blockquote {
    margin: 0.5em 0;
    padding-left: 1em;
    border-left: 4px solid #e5e7eb;
    color: #6b7280;
}
.message-assistant .message-content a {
    color: #2563eb;
    text-decoration: none;
}
.message-assistant .message-content a:hover {
    text-decoration: underline;
}

.message-role {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.tool-call {
    background-color: #fef3c7;
    border: 1px solid #fbbf24;
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #92400e;
}

.chat-input-container {
    display: flex;
    gap: 1rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    resize: none;
    min-height: 60px;
    max-height: 200px;
    font-family: inherit;
}

.chat-input:focus {
    outline: none;
    border-color: #2563eb;
}

.send-button {
    padding: 0.75rem 2rem;
    background-color: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    align-self: flex-end;
}

.send-button:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Animated thinking placeholder */
.message-loading .thinking-dots span {
    display: inline-block;
    animation: thinking-bounce 1.4s ease-in-out infinite both;
}
.message-loading .thinking-dots span:nth-child(1) { animation-delay: -0.32s; }
.message-loading .thinking-dots span:nth-child(2) { animation-delay: -0.16s; }
.message-loading .thinking-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes thinking-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-0.35em); }
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.empty-state h2 {
    margin-bottom: 0.5rem;
    color: #374151;
}

/* Documents list page */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.document-card-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.document-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    display: block;
    flex: 1;
}

.document-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #2563eb;
    transform: translateY(-2px);
}

.document-card-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.document-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    word-break: break-word;
}

.document-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.document-status {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    margin-left: 1rem;
    flex-shrink: 0;
}

.status-finished {
    background-color: #d1fae5;
    color: #065f46;
}

.status-started {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-waiting,
.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-errored {
    background-color: #fee2e2;
    color: #991b1b;
}

.document-card-body {
    margin-top: 0.75rem;
}

.document-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

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

.path-text {
    font-family: monospace;
    font-size: 0.8125rem;
    word-break: break-all;
    color: #4b5563;
}

.document-description {
    margin: 0.75rem 0;
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.5;
    font-style: italic;
}

.document-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.tag {
    background-color: #e0e7ff;
    color: #3730a3;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.reprocess-form {
    margin-top: 0.5rem;
}

.btn-reprocess {
    width: 100%;
    padding: 0.5rem 1rem;
    background-color: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-reprocess:hover:not(:disabled) {
    background-color: #b91c1c;
}

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

/* Document detail page */
.document-header {
    margin-bottom: 2rem;
}

.document-title-enriched {
    margin: 1rem 0 0.5rem 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.document-title-enriched strong {
    font-weight: 600;
    color: #6b7280;
    margin-right: 0.5rem;
}

.document-description-full {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f0f9ff;
    border-left: 3px solid #2563eb;
    border-radius: 4px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #1e3a8a;
}

.document-description-full strong {
    font-weight: 600;
    margin-right: 0.5rem;
}

.document-tags-full {
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.document-tags-full strong {
    font-weight: 600;
    color: #374151;
    margin-right: 0.5rem;
}

.back-link {
    display: inline-block;
    color: #2563eb;
    text-decoration: none;
    margin-bottom: 1rem;
    font-weight: 500;
    transition: color 0.2s;
}

.back-link:hover {
    color: #1d4ed8;
}

.document-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 6px;
}

.info-item {
    font-size: 0.875rem;
    color: #374151;
}

.info-item strong {
    color: #1f2937;
    margin-right: 0.5rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.error-info {
    color: #991b1b;
    width: 100%;
}

.chunks-section {
    margin-top: 2rem;
}

.chunks-section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1f2937;
}

.chunks-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chunk-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.chunk-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chunk-header {
    margin-bottom: 0.75rem;
}

.chunk-meta {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.chunk-content {
    color: #374151;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Compact chunks for detail page */
.chunks-list-compact {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1rem;
}

.chunk-item-compact {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 1rem;
    transition: box-shadow 0.2s;
}

.chunk-item-compact:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chunk-header-compact {
    margin-bottom: 0.5rem;
}

.chunk-meta-compact {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.chunk-content-compact {
    color: #374151;
    line-height: 1.5;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.chunk-memories {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f3f4f6;
}

.memory-item {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.8125rem;
    line-height: 1.4;
}

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

.memory-context {
    background-color: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.memory-fact {
    background-color: #f0fdf4;
    border-left: 3px solid #22c55e;
}

.memory-type {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.6875rem;
    margin-right: 0.5rem;
    color: #6b7280;
}

.memory-content {
    color: #374151;
}

/* ----- Search Result Detail Page ----- */
.sr-detail {
    max-width: 48rem;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.sr-back {
    display: inline-block;
    color: #6b7280;
    text-decoration: none;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.sr-back:hover {
    color: #2563eb;
}

.sr-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.sr-query-badge {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.sr-query-text {
    color: #1f2937;
    font-weight: 600;
}

.sr-doc-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0.25rem 0 0.25rem 0;
}

.sr-doc-filename {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.sr-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.sr-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.sr-badge-desc {
    background: #d1fae5;
    color: #065f46;
}

.sr-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.sr-tag {
    background: #f3e8ff;
    color: #6b21a8;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.sr-view-doc {
    margin-left: auto;
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.sr-view-doc:hover {
    text-decoration: underline;
}

.sr-section {
    margin-bottom: 2rem;
}

.sr-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 0.5rem 0;
}

.sr-section-desc {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0 0 1rem 0;
}

.sr-section-icon {
    opacity: 0.6;
    margin-right: 0.25rem;
}

.sr-description p {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #4b5563;
}

.sr-chunk-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sr-chunk-card {
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.sr-chunk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #f3f4f6;
    font-size: 0.8rem;
}

.sr-chunk-meta {
    color: #6b7280;
}

.sr-chunk-score {
    font-weight: 600;
    color: #1e40af;
}

.sr-chunk-content {
    padding: 1rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #374151;
    white-space: pre-wrap;
}

.sr-memory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.sr-memory-card {
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.sr-context-card {
    background: #eff6ff;
    border-left-color: #3b82f6;
}

.sr-fact-card {
    background: #f0fdf4;
    border-left-color: #22c55e;
}

.sr-memory-content {
    font-size: 0.875rem;
    line-height: 1.5;
    color: #374151;
}

/* Card metadata in search results - make contexts/facts prominent */
.card-meta-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e5e7eb;
}

.card-meta-block {
    margin-bottom: 0.5rem;
}

.card-meta-block:last-child {
    margin-bottom: 0;
}

.card-meta-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.card-meta-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-items: center;
}

.card-meta-more {
    font-size: 0.75rem;
    color: #6b7280;
    font-style: italic;
}

.card-meta-empty {
    font-size: 0.75rem;
    color: #9ca3af;
    font-style: italic;
}

.card-meta-empty code {
    background: #f3f4f6;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.7rem;
}

.card-context-pill {
    display: inline-block;
    margin: 0.15rem 0.25rem 0.15rem 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-fact-pill {
    display: inline-block;
    margin: 0.15rem 0.25rem 0.15rem 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: #f0fdf4;
    color: #166534;
    border-radius: 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----- Test Questions Page ----- */
.page-description {
    font-size: 0.9375rem;
    color: #6b7280;
    margin: 1rem 0 1.5rem 0;
    line-height: 1.5;
}

.page-description code {
    background: #f3f4f6;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.questions-stats {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.stat-item {
    font-weight: 500;
}

.questions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.question-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.question-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.question-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    flex: 1;
    line-height: 1.5;
}

.query-type-badge {
    flex-shrink: 0;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.query-type-badge { background: #f3f4f6; color: #4b5563; }
.query-type-direct { background: #dbeafe; color: #1e40af; }
.query-type-paraphrase { background: #e0e7ff; color: #3730a3; }
.query-type-keyword { background: #fef3c7; color: #92400e; }
.query-type-conceptual { background: #fce7f3; color: #9d174d; }
.query-type-fact_seeking { background: #d1fae5; color: #065f46; }
.query-type-summary_style { background: #f3e8ff; color: #6b21a8; }

.question-meta {
    font-size: 0.875rem;
    color: #4b5563;
}

.meta-row {
    margin-bottom: 0.5rem;
}

.meta-row:last-child {
    margin-bottom: 0;
}

.doc-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

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

.meta-muted {
    color: #9ca3af;
    font-style: italic;
}

.chunk-preview .chunk-meta-info {
    display: block;
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0.25rem 0;
}

.chunk-snippet {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-left: 3px solid #93c5fd;
    border-radius: 4px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.cmd-hint {
    margin: 1rem 0;
    padding: 1rem 1.5rem;
    background: #1f2937;
    color: #e5e7eb;
    border-radius: 6px;
    font-size: 0.875rem;
    overflow-x: auto;
}

/* ----- Eval Runs ----- */
.eval-runs-table-wrapper {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.eval-runs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.eval-runs-table th,
.eval-runs-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.eval-runs-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
}

.eval-runs-table tr:hover td {
    background: #f9fafb;
}

.run-link {
    color: #2563eb;
    text-decoration: none;
    font-family: ui-monospace, monospace;
    font-weight: 500;
}

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

.notes-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.eval-run-header {
    margin-bottom: 2rem;
}

.eval-run-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin: 1rem 0;
    font-size: 0.875rem;
    color: #4b5563;
}

.eval-meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.eval-meta-item code {
    font-size: 0.8125rem;
    background: #f3f4f6;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.eval-notes {
    max-width: 100%;
}

.eval-metrics-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.metrics-block h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 0.5rem 0;
}

.metrics-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.metric {
    font-size: 0.875rem;
    color: #374151;
}

.eval-results-section {
    margin-top: 2rem;
}

.eval-results-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: #1f2937;
}

.eval-result-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.eval-result-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.5rem;
    transition: box-shadow 0.2s;
}

.eval-result-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.eval-result-card.eval-hit {
    border-left: 4px solid #22c55e;
}

.eval-result-card.eval-miss {
    border-left: 4px solid #ef4444;
}

.eval-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.eval-question {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    flex: 1;
    line-height: 1.5;
}

.eval-card-outcome {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.outcome-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.outcome-hit {
    background: #d1fae5;
    color: #065f46;
}

.outcome-miss {
    background: #fee2e2;
    color: #991b1b;
}

.eval-card-target {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #4b5563;
}

.target-chunk-preview {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-left: 3px solid #93c5fd;
    border-radius: 4px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.eval-card-ranks {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #f3f4f6;
}

.rank-section {
    margin-bottom: 0.75rem;
}

.rank-section:last-child {
    margin-bottom: 0;
}

.rank-section strong {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.35rem;
}

.rank-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.rank-pill {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    background: #f3f4f6;
    color: #4b5563;
}

.rank-pill-target {
    background: #d1fae5;
    color: #065f46;
    font-weight: 500;
}

.empty-note {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: 0.5rem;
}
