/* Стили панели, истории и профиля */

.dashboard-section {
    padding: 20px 0 40px;
}

.dashboard-header {
    margin-bottom: 24px;
}

.dashboard-header h1 {
    font-size: 1.75rem;
    margin-bottom: 4px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.ask-card {
    margin-bottom: 24px;
}

.form-row {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 200px;
}

.char-count {
    display: block;
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.textarea-wrapper {
    position: relative;
}

.voice-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    z-index: 10;
}

.voice-btn:hover {
    background: #eef2ff;
    color: #6366f1;
}

.voice-btn.recording {
    background: #fef2f2;
    color: #ef4444;
    animation: pulse-red 1s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.2); }
}

.voice-status {
    font-size: 11px;
    color: #ef4444;
    text-align: center;
    margin-top: 4px;
    min-height: 16px;
    display: none;
}

.voice-status.active {
    display: block;
}

/* Loading */
.loading-card {
    text-align: center;
    padding: 48px 24px;
}

.loading-visual {
    position: relative;
    margin-bottom: 20px;
}

.loading-status {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 16px;
}

.loading-experts-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.loading-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.25;
    animation: loadingPulse 1.4s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.15s);
}

@keyframes loadingPulse {
    0%, 100% { opacity: 0.25; transform: scale(0.85); }
    50% { opacity: 1; transform: scale(1.1); }
}

.loading-steps {
    list-style: none;
    padding: 0;
    margin: 0 auto 12px;
    max-width: 320px;
    text-align: left;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-radius: 8px;
    transition: all 0.3s;
}

.loading-step .ti {
    font-size: 1rem;
    opacity: 0.5;
}

.loading-step.active {
    color: var(--primary);
    background: #f8f7ff;
    font-weight: 500;
}

.loading-step.active .ti {
    opacity: 1;
}

.loading-step.done {
    color: var(--success);
}

.loading-step.done .ti {
    opacity: 1;
}

.loading-hint {
    font-size: 0.85rem;
    margin: 0;
}

.badge-confidence {
    background: #eef2ff;
    color: #6366f1;
    margin-bottom: 12px;
}

.expert-answer code,
.verdict-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
}

.expert-answer pre,
.verdict-content pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 12px 14px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
    margin: 8px 0;
}

.expert-answer pre code,
.verdict-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.expert-round2 {
    border-style: dashed;
}

.verdict-content {
    white-space: normal;
    line-height: 1.65;
}

/* Stats bar */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding: 16px 24px;
}

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

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

/* Verdict */
.verdict-card {
    margin-bottom: 20px;
}

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

.verdict-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.verdict-header-title .ti {
    font-size: 1.5rem;
    color: var(--primary);
}

.verdict-header-title h2 {
    margin: 0;
    font-size: 1.35rem;
}

.gradient-text {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    margin-bottom: 0;
}

.section-heading .ti {
    color: var(--primary);
    font-size: 1.25rem;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-pill {
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.btn-pill .ti {
    font-size: 1rem;
}

.verdict-content {
    white-space: pre-wrap;
    line-height: 1.7;
    font-size: 0.95rem;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.badge-tech {
    background: #dbeafe;
    color: #1d4ed8;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Comparison table */
.table-wrapper {
    overflow-x: auto;
    margin-top: 16px;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

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

.comparison-table th {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

.comparison-table th:first-child {
    background: var(--primary-dark);
}

.comparison-table tbody tr:nth-child(even) {
    background: var(--bg);
}

.comparison-table td:first-child {
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
}

/* Experts grid */
.experts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.expert-card {
    border: 1px solid var(--border);
    border-left: 4px solid var(--expert-color, var(--primary));
    border-radius: var(--radius-sm);
    padding: 16px;
    background: var(--card-bg);
    transition: box-shadow 0.25s ease, transform 0.2s ease;
}

.expert-card:hover {
    box-shadow: 0 0 0 1px var(--border), 0 6px 24px color-mix(in srgb, var(--expert-color, #6366f1) 20%, transparent);
    transform: translateY(-1px);
}

.expert-card.error {
    border-left-color: var(--danger);
    border-color: #fecaca;
    background: #fef2f2;
}

.expert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 8px;
}

.expert-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.expert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--expert-color, var(--primary));
    flex-shrink: 0;
}

.expert-name-block {
    display: flex;
    flex-direction: column;
}

.expert-name {
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.expert-model-id {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', monospace;
    margin-top: 2px;
}

.expert-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.expert-answer {
    white-space: pre-wrap;
    font-size: 0.9rem;
    line-height: 1.6;
}

.expert-error {
    color: var(--danger);
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

/* History */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    padding: 16px 20px;
    cursor: pointer;
    transition: all var(--transition);
}

.history-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.history-question {
    font-weight: 600;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-badges {
    display: flex;
    gap: 6px;
}

.history-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.history-badge .ti {
    font-size: 0.85rem;
}

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

.history-meta .ti {
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 1.25rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.empty-state .ti {
    font-size: 1.5rem;
    color: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
}

.pagination button.active,
.pagination button:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

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

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    max-width: 800px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* Profile */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.stats-grid .stat-box {
    background: var(--bg);
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.stats-grid .stat-box .stat-value {
    font-size: 1.5rem;
}

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

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

    .form-row {
        flex-direction: column;
    }

    .form-row .btn {
        width: 100%;
    }

    .card-header-row,
    .verdict-header {
        flex-direction: column;
        align-items: flex-start;
    }

    #experts-fab {
        right: 16px;
        bottom: 16px;
    }

    #experts-panel {
        right: 16px;
        bottom: 80px;
        width: calc(100vw - 32px);
        max-width: 272px;
    }
}

/* Плавающая панель экспертов */
#experts-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #6366f1;
    color: white;
    border: none;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45);
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
    font-family: inherit;
}

#experts-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.55);
}

.fab-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #10b981;
    color: white;
    font-size: 10px;
    font-weight: 600;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

#experts-panel {
    position: fixed;
    right: 24px;
    bottom: 90px;
    width: 272px;
    background: white;
    border: 0.5px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(99, 102, 241, 0.14);
    z-index: 999;
    opacity: 0;
    transform: translateY(12px) scale(0.97);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
}

#experts-panel.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.ep-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.1rem;
    border-bottom: 0.5px solid #f3f4f6;
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
}

#ep-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.ep-body {
    padding: 0.5rem 0.6rem;
}

.ep-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.6rem;
    border-radius: 10px;
    transition: background 0.15s;
}

.ep-item:hover {
    background: #f8f7ff;
}

.ep-left {
    display: flex;
    align-items: center;
    gap: 9px;
}

.ep-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ep-name {
    font-size: 12px;
    font-weight: 500;
    color: #1f2937;
}

.ep-model {
    font-size: 10px;
    color: #9ca3af;
}

.ep-toggle {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
}

.ep-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ep-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d1d5db;
    border-radius: 18px;
    transition: 0.25s;
}

.ep-slider:before {
    content: '';
    position: absolute;
    width: 13px;
    height: 13px;
    left: 2.5px;
    bottom: 2.5px;
    background: white;
    border-radius: 50%;
    transition: 0.25s;
}

.ep-toggle input:checked + .ep-slider {
    background: #6366f1;
}

.ep-toggle input:checked + .ep-slider:before {
    transform: translateX(15px);
}

.ep-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1.1rem;
    border-top: 0.5px solid #f3f4f6;
    font-size: 11px;
    color: #6b7280;
}

#ep-reset {
    background: none;
    border: none;
    color: #6366f1;
    font-size: 11px;
    cursor: pointer;
    font-family: inherit;
}

/* Results container */
#results-container {
    margin-top: 1.5rem;
}

.loading-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
    background: white;
    border: 0.5px solid #e5e7eb;
    border-radius: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

.loading-experts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 1rem;
}

.loading-expert {
    font-size: 12px;
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 20px;
}

.loading-hint {
    font-size: 0.85rem;
    margin-top: 1rem;
    color: #9ca3af;
}

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

.expert-card {
    background: white;
    border: 0.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 1rem;
    border-left-width: 3px !important;
}

.expert-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.75rem;
}

.expert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.expert-model-tag {
    font-size: 10px;
    color: #9ca3af;
    margin-left: auto;
}

.expert-rating {
    font-size: 11px;
    color: #6366f1;
    font-weight: 600;
}

.expert-card-body {
    font-size: 13px;
    line-height: 1.7;
    color: #374151;
}

.expert-card-body code,
.verdict-text code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
}

.expert-card-body pre,
.verdict-text pre {
    background: #1f2937;
    color: #e5e7eb;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
}

.expert-card-footer {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 0.5rem;
}

.verdict-section {
    background: white;
    border: 1.5px solid #6366f1;
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.verdict-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    color: #6366f1;
    font-size: 15px;
    font-weight: 500;
}

.verdict-header h3 {
    margin: 0;
    font-size: 15px;
}

.verdict-text {
    font-size: 14px;
    line-height: 1.5;
    color: #1f2937;
    margin-bottom: 1rem;
}

.verdict-text .md-p:first-child {
    margin-top: 0;
}

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

.verdict-blocks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.verdict-block {
    background: #f9fafb;
    border-radius: 10px;
    padding: 0.75rem;
    font-size: 12px;
}

.vb-title {
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-size: 11px;
}

.verdict-block ul {
    padding-left: 1rem;
    color: #4b5563;
    margin: 0;
}

.verdict-block li {
    margin-bottom: 3px;
}

.confidence-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1rem;
    font-size: 13px;
}

.confidence-bar {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: #6366f1;
    border-radius: 3px;
    transition: width 0.5s;
}

.confidence-val {
    font-weight: 500;
    color: #6366f1;
}

.verification-note {
    font-size: 12px;
    color: #f59e0b;
    margin-bottom: 1rem;
}

.verdict-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 0.5px solid #e5e7eb;
    background: #f9fafb;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.action-btn:hover {
    background: #f3f4f6;
}

.action-btn.primary {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

.stats-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.stats-row .stat-item {
    background: #f9fafb;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    text-align: center;
    flex: 1;
}

.stats-row .stat-item strong {
    display: block;
    font-size: 18px;
    color: #6366f1;
}

.stats-row .stat-item span {
    font-size: 11px;
    color: #9ca3af;
}

.error-state {
    text-align: center;
    padding: 2rem;
    color: #ef4444;
    background: #fef2f2;
    border-radius: 16px;
    border: 0.5px solid #fecaca;
}

.error-state .ti {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.ratings-section {
    margin: 1rem 0;
    padding: 1.25rem;
}

.ratings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.rating-card {
    background: #f9fafb;
    border-radius: 10px;
    padding: 0.75rem;
    font-size: 12px;
}

.rating-card strong {
    display: block;
    margin-bottom: 4px;
}

.rating-total {
    color: #6366f1;
    font-weight: 700;
    font-size: 14px;
}

.rating-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
    color: #6b7280;
    font-size: 10px;
}

.comparison-card {
    margin: 1rem 0;
    padding: 1.25rem;
}

@media (max-width: 768px) {
    .verdict-blocks {
        grid-template-columns: 1fr;
    }

    .stats-row {
        flex-direction: column;
    }
}

.md-table-wrap {
    overflow-x: auto;
    margin: 0.75rem 0;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.md-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.md-table th {
    background: #f3f4f6;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.md-table td {
    padding: 7px 12px;
    border-bottom: 1px solid #f3f4f6;
    color: #1f2937;
    vertical-align: top;
}

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

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

.format-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 0.5px solid #f3f4f6;
}

.fmt-btn {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 16px;
    border: 0.5px solid #e5e7eb;
    background: #f9fafb;
    cursor: pointer;
    transition: all 0.2s;
}

.fmt-btn:hover {
    background: #eef2ff;
    border-color: #6366f1;
    color: #6366f1;
}

.fmt-btn.rebuild {
    background: #fff7ed;
    border-color: #f59e0b;
    color: #92400e;
}

.verification-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 0.75rem;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff7ed;
    border: 0.5px solid #fed7aa;
    color: #92400e;
    font-size: 13px;
}

.history-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.history-filter-btn {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 16px;
    border: 0.5px solid #e5e7eb;
    background: #fff;
    cursor: pointer;
}

.history-filter-btn.active,
.history-filter-btn:hover {
    background: #eef2ff;
    border-color: #6366f1;
    color: #6366f1;
}

.history-fav-btn {
    border: none;
    background: transparent;
    cursor: pointer;
    color: #6366f1;
    padding: 0;
}

.models-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.75rem;
    border-top: 0.5px solid #f3f4f6;
    flex-wrap: wrap;
}

.models-label {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

.model-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.model-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    cursor: pointer;
    font-size: 11px;
    color: #9ca3af;
    transition: all 0.2s;
    user-select: none;
    opacity: 0.72;
}

.model-chip.active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: #4338ca;
    color: #ffffff;
    font-weight: 600;
    opacity: 1;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.model-chip.active span {
    color: #ffffff;
}

.model-chip:hover {
    border-color: #6366f1;
    opacity: 1;
}

.model-chip.active:hover {
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.55);
}

.models-count {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

.code-block {
    margin: 1rem 0;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    background: #1e1e2e;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    background: #2a2a3e;
    border-bottom: 1px solid #383850;
}

.code-lang {
    font-size: 11px;
    color: #a78bfa;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.code-copy {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
}

.code-copy:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.code-pre {
    margin: 0;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    background: #1e1e2e;
}

.code-pre code {
    font-family: 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.7;
    color: #cdd6f4;
    background: none;
    padding: 0;
    border-radius: 0;
}

.inline-code {
    background: #f3f4f6;
    color: #6366f1;
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    border: 1px solid #e5e7eb;
}

.md-h2 { font-size: 16px; font-weight: 500; color: #1f2937; margin: 1rem 0 0.5rem; }
.md-h3 { font-size: 15px; font-weight: 500; color: #374151; margin: 0.75rem 0 0.4rem; }
.md-h4 { font-size: 14px; font-weight: 500; color: #6366f1; margin: 0.5rem 0 0.3rem; }
.md-h5 { font-size: 13px; font-weight: 600; margin: 0.6rem 0 0.2rem; color: #374151; }
.md-list { padding-left: 1.25rem; margin: 0.5rem 0; }
.md-list li { margin: 4px 0; color: #374151; line-height: 1.6; }
.md-p { margin: 0.2rem 0; line-height: 1.5; color: #374151; }
.md-hr { border: none; border-top: 1px solid #e5e7eb; margin: 1rem 0; }

.attach-btn {
    background: none;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    color: #6b7280;
    font-size: 18px;
    transition: border-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.attach-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
}

.attach-btn.has-file {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
}

.file-preview {
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 8px;
}

.file-preview-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.file-preview-name {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 16px;
    padding: 2px 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.file-remove-btn:hover { color: #ef4444; }
