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

:root {
    /* Light theme */
    --bg-primary: #f5f6f7;
    --bg-secondary: #e9eaeb;
    --bg-tertiary: #ffffff;
    --bg-quaternary: #f0f1f2;
    --bg-input: #ffffff;
    --bg-input-focus: #fafbfc;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --border-primary: #cbd5e0;
    --border-secondary: #e2e8f0;
    --accent-blue: #268bd2;
    --accent-green: #48bb78;
    --accent-red: #e53e3e;
    --accent-orange: #dd6b20;
    --shadow: rgba(0, 0, 0, 0.1);
    --focus-ring: rgba(38, 139, 210, 0.15);
}

[data-theme="dark"] {
    /* Dark theme */
    --bg-primary: #0f1419;
    --bg-secondary: #1a202c;
    --bg-tertiary: #2d3748;
    --bg-quaternary: #1e2832;
    --bg-input: #4a5568;
    --bg-input-focus: #5a6578;
    --text-primary: #ffffff;
    --text-secondary: #f7fafc;
    --text-muted: #e2e8f0;
    --border-primary: #374151;
    --border-secondary: #1a202c;
    --accent-blue: #63b3ed;
    --accent-green: #38a169;
    --accent-red: #fc8181;
    --accent-orange: #f6ad55;
    --shadow: rgba(0, 0, 0, 0.6);
    --focus-ring: rgba(99, 179, 237, 0.25);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-size: 14px;
}

/* Hide scrollbars but keep functionality */
* {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

*::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.app-container {
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px 80px;
    position: relative;
    gap: 20px;
}

.theme-toggle {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px var(--shadow);
}

.theme-toggle:hover {
    background: var(--bg-quaternary);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
}

.main-panel {
    width: 100%;
    max-width: 1600px;
    height: calc(100vh - 40px);
    background: var(--bg-tertiary);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow);
    display: flex;
    overflow: hidden;
    border: 1px solid var(--border-secondary);
}

/* Left Sidebar */
.context-sidebar {
    width: 380px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-radius: 12px 0 0 12px;
}

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

.context-badge {
    background: var(--accent-blue);
    color: var(--bg-tertiary);
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

.query-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.query-item:hover {
    background: #f5f5f7;
    border-color: #d2d2d7;
}

/* Main Processing Area */
.processing-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

.processing-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px;
    background: var(--bg-quaternary);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.processing-block {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: all 0.3s ease;
    position: relative;
}

.processing-block.processing {
    border-color: var(--accent-blue);
    background: var(--bg-tertiary);
    box-shadow: 0 4px 16px var(--shadow);
}

.processing-block.completed {
    border-color: var(--accent-green);
    background: var(--bg-tertiary);
}

.processing-block.error {
    border-color: var(--accent-red);
    background: var(--bg-tertiary);
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-secondary);
}

.block-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.block-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.block-icon.query {
    background: #dbeafe;
    color: #1e40af;
}

.block-icon.upload {
    background: #dcfce7;
    color: #166534;
}

.block-icon.update {
    background: #fef3c7;
    color: #d97706;
}

.block-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-indicator.processing {
    background: var(--accent-green);
    animation: flashDown 1.5s infinite;
}

.status-indicator.completed {
    background: var(--accent-green);
}

.status-indicator.error {
    background: var(--accent-red);
}

.block-content {
    color: var(--text-secondary);
    line-height: 1.6;
}

.user-query {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 14px;
    color: var(--text-secondary);
}

.processing-steps {
    margin: 20px 0;
}

.step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 14px;
    color: #6b7280;
}

.step.active {
    color: #3b82f6;
    font-weight: 500;
}

.step.completed {
    color: #10b981;
}

.step-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    position: relative;
}

.step.active .step-icon {
    border-color: #3b82f6;
    background: #3b82f6;
    animation: spin 1s linear infinite;
}

.step.completed .step-icon {
    border-color: #10b981;
    background: #10b981;
}

.step.completed .step-icon::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.input-container {
    padding: 20px 40px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-primary);
    border-radius: 0 0 12px 0;
}

.mode-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.mode-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover {
    background: var(--bg-quaternary);
    border-color: var(--text-muted);
}

.mode-btn.active {
    background: var(--accent-blue);
    color: var(--bg-tertiary);
    border-color: var(--accent-blue);
}

.input-fields {
    width: 100%;
}

.input-group {
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
}

.input-wrapper textarea {
    width: 100%;
    min-height: 50px;
    max-height: 200px;
    padding: 12px 50px 12px 16px;
    border: 2px solid var(--border-primary);
    border-radius: 12px;
    resize: none;
    font-size: 15px;
    line-height: 1.5;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

.input-wrapper textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--focus-ring);
    background: var(--bg-input-focus);
}

.send-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 36px;
    height: 36px;
    background: var(--accent-blue);
    color: var(--bg-tertiary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
}

.send-btn:hover:not(:disabled) {
    background: var(--accent-orange);
    transform: translateY(-1px);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.send-btn::before {
    content: '→';
    font-weight: bold;
    transform: rotate(-45deg);
    display: inline-block;
}

#updateTextInput {
    min-height: 60px;
}

/* Response Formatting */
.response-content {
    margin-top: 20px;
}

.response-content h1,
.response-content h2,
.response-content h3 {
    color: var(--text-primary);
    margin: 20px 0 12px 0;
    font-weight: 600;
}

.response-content h1 { font-size: 24px; }
.response-content h2 { font-size: 20px; }
.response-content h3 { font-size: 16px; }

.response-content p {
    margin: 12px 0;
    line-height: 1.7;
    color: var(--text-primary);
}

.response-content ul,
.response-content ol {
    margin: 12px 0;
    padding-left: 20px;
}

.response-content li {
    margin: 6px 0;
    line-height: 1.6;
    color: var(--text-primary);
}

.response-content code {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: 0.9em;
}

.response-content pre {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
    color: var(--text-primary);
}

.response-content blockquote {
    border-left: 4px solid var(--accent-blue);
    background: var(--bg-secondary);
    padding: 16px 20px;
    margin: 16px 0;
    color: var(--text-primary);
    font-style: italic;
}

/* Update Input Display */
.update-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 16px 0;
}

.input-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 7px;
    padding: 14px;
    position: relative;
}

.input-label {
    position: absolute;
    top: -7px;
    left: 10px;
    background: var(--bg-tertiary);
    padding: 3px 7px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 3px;
    border: 1px solid var(--border-secondary);
}

.input-text {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-primary);
    margin-top: 3px;
    margin-bottom: 6px;
}

.input-text.expandable {
    max-height: none;
    overflow: visible;
}

.copy-input-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--bg-quaternary);
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.copy-input-btn:hover {
    opacity: 1;
    background: var(--bg-tertiary);
    border-color: var(--accent-blue);
}

.copy-input-btn svg {
    width: 10px;
    height: 10px;
    color: var(--text-muted);
}

.copy-input-btn.copied {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.copy-input-btn.copied svg {
    color: var(--bg-tertiary);
}

.expand-text-btn {
    background: var(--accent-blue);
    color: var(--bg-tertiary);
    border: none;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 6px;
}

.expand-text-btn:hover {
    background: var(--accent-orange);
}

/* Update Result Blocks */
.update-result {
    margin: 24px 0;
}

.paragraph-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    position: relative;
}

.paragraph-block.updated-only {
    border-left: 4px solid #10b981;
}

.paragraph-label {
    position: absolute;
    top: -8px;
    left: 16px;
    background: white;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.paragraph-label.updated {
    color: #059669;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.paragraph-text {
    line-height: 1.7;
    color: #374151;
    margin-top: 8px;
}

/* Query Box Styles */
.query-box {
    margin-bottom: 16px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-tertiary);
    overflow: hidden;
}

.query-box-header {
    cursor: pointer;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.query-box-header:hover {
    background: var(--bg-quaternary);
}

.query-box-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.query-text-preview {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    flex: 1;
    margin: 0 8px;
}

.query-type {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    background: var(--accent-blue);
    color: var(--bg-tertiary);
}

.query-box-indicator {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.query-box.expanded .query-box-indicator {
    transform: rotate(180deg);
}

.query-summary {
    font-size: 11px;
    color: var(--text-muted);
}

.chunks-total {
    padding: 2px 6px;
    background: var(--bg-quaternary);
    border-radius: 8px;
    font-weight: 500;
}

.query-box-content {
    padding: 16px;
}

.query-full-text {
    background: var(--bg-quaternary);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    font-weight: 500;
}

/* Query Header Styles */
.query-header {
    cursor: pointer;
    padding: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.query-header:hover {
    background: var(--bg-quaternary);
    border-color: var(--text-muted);
}

.query-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    margin-right: 12px;
}

.query-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
}

.chunks-count {
    padding: 2px 6px;
    background: var(--bg-quaternary);
    border-radius: 10px;
    font-weight: 500;
}

.query-chunks {
    border-left: 2px solid var(--border-secondary);
    padding-left: 12px;
}

.more-chunks-info {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.copy-paragraph-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.copy-paragraph-btn:hover {
    opacity: 1;
    background: white;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.copy-paragraph-btn.copied {
    background: #dcfce7;
    border-color: #86efac;
}

.copy-paragraph-btn svg {
    width: 14px;
    height: 14px;
    color: #6b7280;
}

.copy-paragraph-btn.copied svg {
    color: #059669;
}

/* Processing Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes flashDown {
    0% {
        opacity: 1;
        transform: translateY(0px);
    }
    50% {
        opacity: 0.3;
        transform: translateY(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0px);
    }
}

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

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

.processing-block {
    animation: slideInUp 0.4s ease-out;
}

/* Clickable Chunks */
.chunk-item {
    margin-bottom: 12px;
    padding: 8px;
    background: var(--bg-quaternary);
    border-radius: 6px;
    border-left: 3px solid var(--score-color);
    transition: all 0.2s ease;
}

.chunk-item:hover {
    background: var(--bg-secondary);
    border-left-width: 4px;
    transform: translateX(2px);
}

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

.chunk-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

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

.detail-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.detail-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: var(--bg-tertiary);
    transform: translateY(-1px);
}

.chunk-score {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
}

.chunk-preview {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.chunk-query {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

/* Right Panel */
.utils-container {
    width: 300px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-primary);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-radius: 0 12px 12px 0;
}

.utils-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
}

.utils-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.rag-settings {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rag-settings label {
    font-size: 13px;
    color: var(--text-secondary);
}

.k-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-primary);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.k-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-blue);
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow);
    transition: background 0.2s ease;
}

.k-slider::-webkit-slider-thumb:hover {
    background: var(--accent-orange);
}

.query-counter {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 4px;
}

.upload-btn {
    padding: 12px 16px;
    border: 1px solid var(--accent-green);
    border-radius: 8px;
    background: var(--accent-green);
    color: var(--bg-tertiary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
}

.upload-btn:hover {
    background: var(--accent-orange);
    border-color: var(--accent-orange);
}

.welcome-message {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-muted);
    margin: auto;
}

.welcome-message h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.welcome-message p {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Copy Button */
.copy-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    justify-content: flex-end;
}

.copy-response-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    transition: all 0.2s ease;
}

.copy-response-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.copy-response-btn.copied {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #059669;
}

.copy-response-btn svg {
    width: 14px;
    height: 14px;
}

.copy-response-btn.copied svg {
    color: #059669;
}

/* Source Detail Modal */
.detail-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.detail-modal-overlay.show {
    opacity: 1;
}

.detail-modal {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px var(--shadow);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.detail-modal-overlay.show .detail-modal {
    transform: translateY(0);
}

.detail-modal-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.detail-close-btn:hover {
    background: var(--bg-quaternary);
    color: var(--text-primary);
}

.detail-modal-content {
    padding: 24px;
    max-height: calc(85vh - 80px);
    overflow-y: auto;
}

.detail-section {
    margin-bottom: 24px;
}

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

.detail-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.detail-copy-btn {
    background: var(--bg-quaternary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.detail-copy-btn:hover {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: var(--bg-tertiary);
}

.detail-copy-btn.copied {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: var(--bg-tertiary);
}

.detail-content-box {
    background: var(--bg-quaternary);
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    padding: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.detail-metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.detail-metadata-item {
    background: var(--bg-quaternary);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    padding: 12px;
}

.detail-metadata-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.detail-metadata-value {
    font-size: 13px;
    color: var(--text-primary);
    font-family: ui-monospace, SFMono-Regular, monospace;
    word-break: break-all;
}

.detail-score-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 1400px) {
    .app-container {
        padding: 15px 60px;
        gap: 15px;
    }

    .context-sidebar {
        width: 320px;
    }

    .utils-container {
        width: 280px;
    }
}

@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        gap: 15px;
    }

    .main-panel {
        flex-direction: column;
        height: auto;
        min-height: 70vh;
    }

    .context-sidebar {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-primary);
        border-radius: 12px 12px 0 0;
    }

    .utils-container {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--border-primary);
        border-radius: 0 0 12px 12px;
        flex-direction: row;
        gap: 20px;
    }

    .utils-section {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 10px 30px;
        gap: 10px;
    }

    .processing-area {
        padding: 15px 20px;
    }

    .processing-block {
        padding: 16px;
    }

    .input-container {
        padding: 15px 20px;
    }

    .utils-container {
        flex-direction: column;
        gap: 15px;
    }

    .detail-modal {
        max-width: 95%;
        margin: 10px;
    }

    .detail-modal-content {
        padding: 16px;
    }

    .detail-metadata-grid {
        grid-template-columns: 1fr;
    }

    .update-inputs {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}