.ngen-container {
    height: 100%;
    background: #f1f3f4;
    display: flex;
    flex-direction: column;
}

.search-block .mx-auto {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ngen-mode {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #233c5e;
    color: #fff;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.ngen-mode:hover,
.ngen-mode:focus {
    background: #2e4c78;
    color: #fff;
    text-decoration: none;
}

.ngen-greeting {
    flex: 1;
    align-items: flex-start;
    justify-content: center;
    padding: 15vh 20px 40px;
}

.ngen-greeting-content {
    width: 100%;
    max-width: 640px;
    text-align: center;
}

.ngen-greeting-title {
    font-size: 48px;
    font-weight: 700;
    color: #233c5e;
    margin-bottom: 12px;
    line-height: 1.1;
}

.ngen-greeting-subtitle {
    color: #5a6b7f;
    font-size: 18px;
    margin-bottom: 32px;
}

.ngen-greeting-subtitle a {
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.ngen-input-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #d5dae0;
    border-radius: 32px;
    padding: 6px 6px 6px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ngen-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    padding: 14px 8px;
    color: #222;
}

.ngen-input::placeholder {
    color: #8a94a6;
}

.ngen-submit-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #233c5e;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease;
}

.ngen-submit-btn:hover {
    background: #2e4c78;
}

.ngen-submit-btn i {
    font-size: 14px;
}

.ngen-chat {
    flex: 1;
    padding: 24px;
    min-height: 0;
}

.ngen-chat-wrapper {
    display: flex;
    gap: 20px;
    height: calc(100vh - 240px);
    max-width: 1400px;
    margin: 0 auto;
}

.ngen-chat-main {
    flex: 1 1 65%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.ngen-chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
}

.ngen-chat-input-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #d5dae0;
    border-radius: 28px;
    padding: 6px 6px 6px 24px;
    margin: 0 24px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.ngen-chat-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    padding: 12px 8px;
    color: #222;
}

.ngen-message {
    margin-bottom: 20px;
    display: flex;
}

.ngen-message-user {
    justify-content: flex-end;
}

.ngen-message-user .ngen-message-content {
    max-width: 75%;
    background: #d8e5f0;
    color: #1f3a5f;
    padding: 10px 18px;
    border-radius: 18px;
}

.ngen-message-assistant {
    justify-content: flex-start;
}

.ngen-message-assistant .ngen-message-content {
    max-width: 100%;
    color: #333;
    line-height: 1.55;
}

.ngen-message-text p {
    margin: 0 0 12px;
}

.ngen-message-text p:last-child {
    margin-bottom: 0;
}

.ngen-message-text h1,
.ngen-message-text h2,
.ngen-message-text h3,
.ngen-message-text h4 {
    font-weight: 700;
    color: #222;
    margin: 18px 0 8px;
}

.ngen-message-text h1 { font-size: 22px; }
.ngen-message-text h2 { font-size: 19px; }
.ngen-message-text h3 { font-size: 17px; }
.ngen-message-text h4 { font-size: 15px; }

.ngen-message-text ul,
.ngen-message-text ol {
    margin: 8px 0 12px;
    padding-left: 22px;
}

.ngen-message-text li {
    margin-bottom: 6px;
}

.ngen-message-text strong {
    font-weight: 600;
    color: #222;
}

.ngen-message-text code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.ngen-message-text a {
    color: #233c5e;
    text-decoration: underline;
}

.ngen-loading-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #8a94a6;
}

.ngen-loading-dots {
    display: inline-flex;
    gap: 4px;
}

.ngen-loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #8a94a6;
    animation: ngen-bounce 1.2s infinite ease-in-out;
}

.ngen-loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.ngen-loading-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ngen-bounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%           { transform: scale(1);   opacity: 1; }
}

.ngen-chat-sidebar {
    flex: 0 0 320px;
    overflow-y: auto;
    padding-right: 4px;
}

.ngen-sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ngen-source-item {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ngen-source-item:hover {
    border-color: #b8bfc7;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.ngen-source-item.active {
    border-color: #8a94a6;
}

.ngen-source-thumbnail {
    width: 100%;
    height: 140px;
    background: #f1f3f4;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

.ngen-source-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ngen-source-thumbnail i {
    font-size: 36px;
    color: #8a94a6;
}

.ngen-source-title {
    font-size: 14px;
    font-weight: 600;
    color: #222;
    line-height: 1.35;
    margin-bottom: 6px;
    word-break: break-word;
}

.ngen-source-meta {
    font-size: 12px;
    color: #6b7584;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ngen-source-download-icon {
    font-size: 11px;
    color: #6b7584;
    margin-left: 4px;
}

.ngen-loading-text {
    display: none;
    font-size: 12px;
    color: #6b7584;
    margin-top: 6px;
}

.ngen-source-item.loading .ngen-loading-text {
    display: block;
}