﻿        .main {
            display: grid;
            grid-template-rows: auto 1fr auto;
            min-height: var(--app-height);
            height: var(--app-height);
            min-width: 0;
            overflow: hidden;
        }

        .topbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 16px;
            padding: 14px 24px;
            border-bottom: 1px solid var(--line);
            background: rgba(255, 255, 255, 0.84);
            backdrop-filter: blur(10px);
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .topbar-main {
            display: flex;
            align-items: center;
            gap: 10px;
            min-width: 0;
        }

        .topbar-text {
            display: flex;
            flex-direction: column;
            gap: 2px;
            min-width: 0;
        }

        .topbar-actions {
            display: flex;
            align-items: center;
            gap: 8px;
            min-width: 0;
        }

        .title {
            font-size: 14px;
            font-weight: 800;
            color: #0f172a;
            letter-spacing: 0.01em;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .topbar-subtitle {
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: #94a3b8;
        }

        .model-badge {
            font-family: "IBM Plex Mono", monospace;
            font-size: 11px;
            color: #1e3a8a;
            background: var(--accent-soft);
            border: 1px solid #bfdbfe;
            padding: 6px 11px;
            border-radius: 999px;
            white-space: nowrap;
        }

        .mobile-new-chat {
            display: none;
            border: 1px solid #c9d8ee;
            background: #f8fbff;
            color: #1e3a8a;
            border-radius: 999px;
            padding: 6px 10px;
            font-size: 11px;
            font-weight: 700;
            cursor: pointer;
            white-space: nowrap;
        }

        .mobile-new-chat:hover {
            background: #eef4ff;
            border-color: #b8cdf0;
        }

        .mobile-menu-btn {
            display: none;
            width: 34px;
            height: 34px;
            border: 1px solid #c9d8ee;
            background: #f8fbff;
            color: #1e3a8a;
            border-radius: 10px;
            align-items: center;
            justify-content: center;
            padding: 0;
            cursor: pointer;
            flex: 0 0 auto;
        }

        .mobile-menu-btn:hover {
            background: #eef4ff;
            border-color: #b8cdf0;
        }

        .mobile-menu-btn svg {
            width: 16px;
            height: 16px;
        }

        .sidebar-backdrop {
            display: none;
        }

        .messages-wrap {
            overflow: auto;
            -webkit-overflow-scrolling: touch;
            min-height: 0;
            background:
                radial-gradient(40rem 16rem at 0% 0%, rgba(219, 234, 254, 0.35), transparent 72%),
                linear-gradient(to bottom, #ffffff, #f8fbff 32%, #f8fbff 100%);
        }

        .messages {
            max-width: 980px;
            margin: 0 auto;
            padding: 24px 22px 136px;
        }

        .message-row {
            display: flex;
            margin-bottom: 14px;
        }

        .message-row.is-entering {
            animation: message-enter-assistant 0.22s ease both;
            animation-delay: var(--enter-stagger, 0ms);
        }

        .message-row.user.is-entering {
            animation-name: message-enter-user;
        }

        .message-row.user {
            justify-content: flex-end;
        }

        @keyframes message-enter-assistant {
            from {
                opacity: 0;
                transform: translateY(8px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes message-enter-user {
            from {
                opacity: 0;
                transform: translateY(8px) translateX(4px);
            }
            to {
                opacity: 1;
                transform: translateY(0) translateX(0);
            }
        }

        .bubble {
            max-width: min(88%, 760px);
            border-radius: 18px;
            padding: 13px 15px 14px;
            border: 1px solid var(--line);
            line-height: 1.62;
            word-break: break-word;
            box-shadow: var(--shadow-tiny);
        }

        .bubble-content {
            display: flex;
            flex-direction: column;
            gap: 10px;
        }

        .assistant-confidence-row {
            display: flex;
            align-items: center;
            justify-content: flex-start;
        }

        .assistant-confidence-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            border-radius: 999px;
            border: 1px solid #d8e3f4;
            background: #f8fbff;
            color: #334155;
            font-family: "IBM Plex Mono", monospace;
            font-size: 10px;
            line-height: 1.2;
            padding: 4px 8px;
            white-space: nowrap;
        }

        .assistant-confidence-badge::before {
            content: "";
            width: 7px;
            height: 7px;
            border-radius: 999px;
            background: #94a3b8;
            flex: 0 0 auto;
        }

        .assistant-confidence-badge.is-high {
            border-color: #bfe9d4;
            background: #f1fcf6;
            color: #166534;
        }

        .assistant-confidence-badge.is-high::before {
            background: #16a34a;
        }

        .assistant-confidence-badge.is-medium {
            border-color: #dbe6f8;
            background: #f7fbff;
            color: #1e40af;
        }

        .assistant-confidence-badge.is-medium::before {
            background: #3b82f6;
        }

        .assistant-confidence-badge.is-low {
            border-color: #f4d7dc;
            background: #fff7f8;
            color: #9f1239;
        }

        .assistant-confidence-badge.is-low::before {
            background: #e11d48;
        }

        .assistant-disclaimer {
            margin: 2px 0 0;
            font-size: 11px;
            line-height: 1.45;
            color: #64748b;
        }

        .assistant-citations {
            margin-top: 2px;
            border: 1px solid #dce6f5;
            border-radius: 12px;
            background: #f8fbff;
            padding: 8px 9px;
        }

        .assistant-citations-label {
            margin: 0 0 6px;
            font-size: 10px;
            font-weight: 700;
            color: #64748b;
            letter-spacing: 0.04em;
            text-transform: uppercase;
        }

        .assistant-citations-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .assistant-citation-item {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .assistant-citation-link {
            color: #1d4ed8;
            text-decoration: none;
            font-size: 12px;
            line-height: 1.35;
            word-break: break-word;
        }

        .assistant-citation-link:hover {
            text-decoration: underline;
        }

        .assistant-citation-meta {
            margin: 0;
            font-size: 10px;
            color: #64748b;
            line-height: 1.35;
            word-break: break-word;
        }

        .bubble-archive-content {
            display: flex;
            flex-direction: column;
            gap: 10px;
            position: relative;
        }

        .bubble-archive-content.is-collapsed {
            overflow: hidden;
        }

        .bubble-archive-content.is-collapsed::after {
            content: "";
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            height: 72px;
            pointer-events: none;
            background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(248, 251, 255, 0.97));
        }

        .bubble-tools {
            display: flex;
            justify-content: flex-end;
            gap: 6px;
            flex-wrap: wrap;
        }

        @media (hover: hover) and (pointer: fine) {
            .message-row.assistant .bubble-tools {
                max-height: 0;
                margin: 0;
                opacity: 0;
                overflow: hidden;
                pointer-events: none;
                transform: translateY(-2px);
                transition:
                    max-height 0.16s ease,
                    margin 0.16s ease,
                    opacity 0.16s ease,
                    transform 0.16s ease;
            }

            .message-row.assistant .bubble:hover .bubble-tools,
            .message-row.assistant .bubble:focus-within .bubble-tools {
                max-height: 96px;
                margin-bottom: 8px;
                opacity: 1;
                pointer-events: auto;
                transform: translateY(0);
            }
        }

        .bubble-copy-all,
        .bubble-copy-md,
        .bubble-regenerate,
        .bubble-edit-user,
        .bubble-archive-toggle {
            border: 1px solid #d7e1ef;
            background: #f8fafc;
            color: #475569;
            font-family: "IBM Plex Mono", monospace;
            font-size: 11px;
            border-radius: 8px;
            padding: 4px 8px;
            cursor: pointer;
            transition: 0.2s ease;
        }

        .bubble-copy-all:hover,
        .bubble-copy-md:hover,
        .bubble-regenerate:hover,
        .bubble-edit-user:hover,
        .bubble-archive-toggle:hover {
            background: #f1f5f9;
            border-color: #cbd5e1;
        }

        .bubble-copy-all.copied,
        .bubble-copy-md.copied {
            background: var(--accent-strong);
            border-color: var(--accent-strong);
            color: #eef4ff;
        }

        .bubble-tools-user {
            margin-top: 8px;
        }

        .message-row.user .bubble-tools-user {
            justify-content: flex-end;
        }

        .message-row.user .user-inline-editor {
            margin-top: 10px;
            border: 1px solid rgba(219, 234, 254, 0.7);
            background: rgba(15, 23, 42, 0.16);
            border-radius: 12px;
            padding: 8px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .message-row.user .user-inline-input {
            width: 100%;
            min-height: 68px;
            max-height: 220px;
            resize: vertical;
            border: 1px solid rgba(191, 219, 254, 0.72);
            border-radius: 10px;
            background: rgba(15, 23, 42, 0.24);
            color: #e2e8f0;
            padding: 8px 9px;
            line-height: 1.45;
            font: inherit;
        }

        .message-row.user .user-inline-input::placeholder {
            color: rgba(219, 234, 254, 0.78);
        }

        .message-row.user .user-inline-input:focus {
            border-color: rgba(191, 219, 254, 0.95);
            box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.28);
            outline: none;
        }

        .message-row.user .user-inline-actions {
            display: flex;
            justify-content: flex-end;
            gap: 6px;
            flex-wrap: wrap;
        }

        .message-row.user .user-inline-cancel,
        .message-row.user .user-inline-submit {
            border: 1px solid rgba(191, 219, 254, 0.75);
            background: rgba(15, 23, 42, 0.22);
            color: #dbeafe;
            font-family: "IBM Plex Mono", monospace;
            font-size: 11px;
            border-radius: 8px;
            padding: 4px 9px;
            cursor: pointer;
            transition: 0.2s ease;
        }

        .message-row.user .user-inline-submit {
            background: rgba(30, 58, 138, 0.78);
            border-color: rgba(191, 219, 254, 0.88);
        }

        .message-row.user .user-inline-cancel:hover,
        .message-row.user .user-inline-submit:hover {
            background: rgba(15, 23, 42, 0.3);
            border-color: rgba(219, 234, 254, 0.95);
        }

        .message-row.user .user-inline-submit:hover {
            background: rgba(30, 58, 138, 0.95);
        }

        .message-row.user .user-inline-cancel:disabled,
        .message-row.user .user-inline-submit:disabled {
            opacity: 0.64;
            cursor: not-allowed;
        }

        .message-row.user .bubble-edit-user {
            border-color: rgba(219, 234, 254, 0.65);
            background: rgba(15, 23, 42, 0.15);
            color: #dbeafe;
        }

        .message-row.user .bubble-edit-user:hover {
            border-color: rgba(191, 219, 254, 0.85);
            background: rgba(15, 23, 42, 0.22);
        }

        .msg-text {
            white-space: normal;
            display: flex;
            flex-direction: column;
            gap: 7px;
        }

        .msg-paragraph {
            margin: 0;
            white-space: pre-wrap;
            line-height: 1.58;
        }

        .msg-list {
            margin: 0;
            padding-left: 18px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .msg-olist {
            margin: 0;
            padding-left: 20px;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .msg-heading {
            margin: 0;
            line-height: 1.4;
            font-weight: 700;
            color: inherit;
        }

        .msg-heading-1 {
            font-size: 1.08rem;
        }

        .msg-heading-2 {
            font-size: 1.02rem;
        }

        .msg-heading-3 {
            font-size: 0.98rem;
        }

        .msg-heading-4,
        .msg-heading-5,
        .msg-heading-6 {
            font-size: 0.95rem;
        }

        .msg-link {
            color: #1d4ed8;
            text-decoration: none;
            border-bottom: 1px dashed #93c5fd;
            word-break: break-all;
        }

        .msg-link:hover {
            text-decoration: underline;
        }

        .code-block {
            border: 1px solid #d6deea;
            border-radius: 12px;
            overflow: hidden;
            background: #f8fafc;
        }

        .code-head {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 10px;
            border-bottom: 1px solid #dce5f2;
            background: #f1f5f9;
        }

        .code-lang {
            font-family: "IBM Plex Mono", monospace;
            font-size: 12px;
            color: #475569;
            text-transform: lowercase;
        }

        .code-copy {
            border: 1px solid #ccd8ea;
            background: #ffffff;
            color: #334155;
            font-family: "IBM Plex Mono", monospace;
            font-size: 11px;
            border-radius: 7px;
            padding: 4px 8px;
            cursor: pointer;
            transition: 0.2s ease;
        }

        .code-copy:hover {
            background: #eff6ff;
        }

        .code-copy.copied {
            background: var(--accent-strong);
            border-color: var(--accent-strong);
            color: #eef4ff;
        }

        .code-pre {
            margin: 0;
            padding: 12px;
            overflow-x: auto;
            color: #1e293b;
            font-size: 13px;
            line-height: 1.55;
            font-family: "IBM Plex Mono", monospace;
            white-space: pre;
        }

        .message-row.assistant .bubble {
            background: var(--assistant-bubble);
            color: var(--assistant-ink);
            border-color: #e2e8f0;
            border-top-left-radius: 8px;
        }

        .message-row.user .bubble {
            background: var(--user-bubble);
            color: var(--user-ink);
            border-color: #1e3a8a;
            border-top-right-radius: 8px;
            box-shadow: 0 14px 26px rgba(30, 58, 138, 0.22);
        }

        .message-row.user .msg-link {
            color: #dbeafe;
            border-bottom-color: rgba(219, 234, 254, 0.7);
        }

