:root {
    --body-bg: #0f0c29;
    --body-gradient: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: blur(12px);
    --accent-color: #f2511b;
    --accent-gradient: linear-gradient(135deg, #f2511b, #e0400b);
    --accent-glow: 0 0 15px rgba(242, 81, 27, 0.5);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --font-heading: 'Outfit', sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue';
    --font-body: 'Inter', sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue';
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--body-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100dvh;
    font-family: var(--font-body);
}


.container {
    display: flex;
    align-items: center;
    flex-direction: column;
    height: 100dvh;
    width: 100dvw;
    margin: 0 auto;
    transition: margin-left 0.3s ease;
}

@media (min-width: 769px) {

    .container {
        width: calc(100dvw - 260px);
        margin-left: 260px;
    }

    .sidebar {
        width: 260px;
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
    }

    .btn-new-chat,
    .btnVoltar {
        width: 100%;
        transition: padding 0.3s ease, background 0.2s;
    }

    .btn-new-chat span,
    .btnVoltar span {
        opacity: 1;
        max-width: 150px;
        white-space: nowrap;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: inline-block;
    }

    .sidebar.collapsed {
        transform: translateX(0);
        width: 80px;
    }

    .sidebar.collapsed .sidebar-header,
    .sidebar.collapsed .sidebar-footer {
        padding: 1.5rem 0;
        display: flex;
        justify-content: center;
    }

    .sidebar.collapsed .sidebar-header {
        padding-top: 4.5rem;
    }

    .sidebar.collapsed .btn-new-chat,
    .sidebar.collapsed .btnVoltar {
        width: 44px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
        gap: 0;
    }

    .sidebar.collapsed .btn-new-chat span,
    .sidebar.collapsed .btnVoltar span {
        opacity: 0;
        max-width: 0;
        margin: 0;
    }

    .sidebar.collapsed .chat-list {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .sidebar.collapsed .btn-new-chat svg,
    .sidebar.collapsed .btnVoltar img {
        margin: 0;
        min-width: 20px;
        min-height: 20px;
    }

    .container.full-width {
        margin-left: 80px;
        width: calc(100dvw - 80px);
    }
}

.messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding: 2rem;
}

.messages>* {
    width: 100%;
    max-width: 800px;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    position: relative;
    border-radius: 16px;
    padding: 1rem 1.5rem;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.6;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
}

.rowUser {
    display: flex;
    width: 100%;
    padding: 0.5rem 0;
    justify-content: flex-end;
    animation: slideUpFade 0.4s ease-out forwards;
}

.rowUser .message {
    background: var(--current-chat-color, var(--accent-gradient));
    color: var(--current-chat-text-color, white);
    border-bottom-right-radius: 4px;
    box-shadow: 0 0 15px color-mix(in srgb, var(--current-chat-color, var(--accent-color)) 50%, transparent);
}

.rowAssistant {
    display: flex;
    width: 100%;
    padding: 0.5rem 0;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideUpFade 0.4s ease-out forwards;
}

.rowAssistant .avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

.rowAssistant .message {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top-left-radius: 4px;
}

.rowAssistant .message.is-streaming {
    background: linear-gradient(90deg, var(--glass-bg) 25%, rgba(255, 255, 255, 0.1) 50%, var(--glass-bg) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

.skeleton-loading {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 300px;
    width: 100%;
}

.skeleton-line {
    height: 16px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08) 25%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.08) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 6px;
}

.skeleton-line:nth-child(1) {
    width: 280px;
}

.skeleton-line:nth-child(2) {
    width: 220px;
}

.skeleton-line:nth-child(3) {
    width: 160px;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.rowAssistant .error-message {
    color: red;
}

.message-stats {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-family: 'Inter', monospace;
    letter-spacing: 0.02em;
}

.rowAssistant .message pre {
    border-radius: 10px;
    overflow-x: auto;
    font-size: 0.9em;
    margin: 0;
}

.rowAssistant .message ul,
.rowAssistant .message ol {
    padding-inline-start: 1.5625rem;
    margin: 0.625rem 0;
}

.rowAssistant .message p {
    margin: 0.625rem 0;
}

.rowAssistant .message> :first-child {
    margin-top: 0;
}

.rowAssistant .message> :last-child {
    margin-bottom: 0;
}

.rowAssistant .message a {
    color: var(--accent-color);
    text-decoration-color: var(--accent-color);
    font-weight: 600;
    transition: color 0.2s;
}

.rowAssistant .message a:hover {
    color: var(--accent-color-hover);
    text-decoration-color: var(--accent-color-hover);
}

.form-group {
    width: 100%;
    max-width: 848px;
    margin: 0 auto;
    display: flex;
    padding: 0 1.25rem 1.25rem 1.25rem;
    align-items: center;
    gap: 0.625rem;
}

.form-control {
    flex: 1;
    padding: 14px 1.5rem;
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    font-size: 1rem;
    line-height: 24px;
    min-height: 52px;
    max-height: 200px;
    overflow-y: auto;
    margin-right: 0;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    resize: none;
    outline: none;
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    font-family: var(--font-body);
    box-sizing: border-box;
}

.form-control:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(242, 81, 27, 0.2);
}

.form-control::placeholder {
    color: var(--text-secondary);
    line-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sendButton,
#stopButton {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 3rem;
    height: 3rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

#sendButton {
    background: var(--current-chat-color, var(--accent-gradient));
    color: white;
    box-shadow: 0 0 15px color-mix(in srgb, var(--current-chat-color, var(--accent-color)) 50%, transparent);
}

#sendButton:hover {
    transform: scale(1.1);
    box-shadow: 0 0 25px color-mix(in srgb, var(--current-chat-color, var(--accent-color)) 70%, transparent);
}

#stopButton {
    background-color: #dc3545;
    color: var(--text-color);
}

#stopButton:hover {
    background-color: #c82333;
    transform: scale(1.05);
}

.icon-send {
    transform: rotate(90deg);
}

#stopButton:hover {
    background-color: #c82333;
}

.typing-indicator {
    display: inline-block;
    width: 1.5rem;
    height: 0.625rem;
    position: relative;
    top: 0.3125rem;
    left: 0;
}

.typing-indicator::before,
.typing-indicator::after {
    content: '';
    position: absolute;
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    background-color: var(--text-secondary);
    animation: typing 1s infinite ease-in-out;
}

.typing-indicator::before {
    left: 0;
    animation-delay: 0s;
}

.typing-indicator::after {
    left: 1.125rem;
    animation-delay: 0.5s;
}

@keyframes typing {

    0%,
    100% {
        transform: translateY(0);
        background-color: #aaa;
    }

    50% {
        transform: translateY(-5px);
        background-color: #888;
    }
}

.code-block-wrapper {
    position: relative;
    margin: 10px 0;
}

.copy-code-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: var(--base-color);
    color: var(--text-color);
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: opacity 0.2s, background-color 0.2s;
}

.copy-code-button:hover {
    background-color: var(--base-color-hover);
}

progress::-webkit-progress-value {
    background-color: var(--accent-color);
}

progress::-webkit-progress-bar {
    background-color: var(--base-color);
}

progress {
    background-color: var(--base-color);
    color: var(--accent-color);
    height: 0.625rem;
    border-radius: 10px;
    overflow: hidden;
}


.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100%;
    background: rgba(15, 12, 41, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transform: translateX(0);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.btn-new-chat {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-new-chat:hover {
    background: var(--glass-border);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.5rem 0 0.5rem;
}

.chat-item {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.2s;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chat-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.chat-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.chat-item:hover .chat-actions {
    opacity: 1;
}

.chat-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.chat-action-btn.delete:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.chat-item:hover {
    background: var(--glass-bg);
    color: var(--text-primary);
}

.chat-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-weight: 500;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
}

.menu-button {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 110;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: none;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 90;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .container {
        width: 100dvw;
        margin-left: 0;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-button {
        display: block;
    }

    .btnVoltar {
        position: static;
        width: 100%;
    }
}

.btnVoltar {
    position: static;
    top: auto;
    left: auto;
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 0.75rem;
    height: 44px;
    padding: 0 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btnVoltar:hover {
    background: var(--glass-border);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btnNewChat {
    display: none;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: #1a1b26;
    width: 90%;
    max-width: 600px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal.active .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.2);
}

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.close-modal:hover {
    color: white;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-body p {
    margin: 0;
    text-align: left;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    background-color: rgba(0, 0, 0, 0.2);
}

.personas-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    width: 100%;
    padding-bottom: 2rem;
    padding-right: 0.5rem;
}

@media (max-width: 600px) {
    .personas-list {
        grid-template-columns: 1fr;
    }
}

.persona-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.2s;
}

.persona-item:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
}

.persona-info {
    flex: 1;
    width: 100%;
}

.persona-info strong {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.persona-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.persona-actions {
    display: flex;
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--glass-border);
    padding-top: 0.75rem;
}

.persona-editor {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.editor-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.btn-primary {
    background: var(--accent-gradient);
    border: 1px solid transparent;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: box-shadow 0.2s, background 0.2s;
    font-family: var(--font-body);
}

.btn-primary:hover {
    box-shadow: var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: var(--font-body);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-primary-small {
    background: var(--accent-color);
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-primary-small:hover {
    filter: brightness(1.1);
}

.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--glass-border);
}

.footer-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.footer-icon-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-icon-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-small:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.footer-chats-row {
    display: flex;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-chat-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-chat-action:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-primary-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-body);
}

.btn-primary-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-icon-small {
    padding: 4px;
}

.modal-form-group {
    width: 100%;
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.modal-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.modal-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    font-family: var(--font-body);
}

.modal-input:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(242, 81, 27, 0.2);
}

textarea.modal-input {
    resize: vertical;
    min-height: 100px;
    line-height: 1.5;
}

.chat-item.persona-custom {
    border-left: 3px solid var(--accent-color);
    padding-left: 1rem;
}

.modal-form-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.modal-form-row .modal-form-group {
    flex: 1;
    margin-bottom: 0;
}

.color-preview {
    width: 100%;
    height: 44px;
    border-radius: 0.75rem;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-preview:hover {
    transform: scale(1.02);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.color-picker {
    position: absolute;
    top: 100%;
    left: 0;
    width: 280px;
    background: #1a1b26;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
    padding: 0.75rem;
    margin-top: 0.5rem;
    backdrop-filter: blur(10px);
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.color-btn {
    width: 36px;
    height: 36px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.color-btn.selected {
    border-color: white;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.modal-input.text-center {
    text-align: center;
    font-size: 1.5rem;
    padding: 0.25rem 0.5rem;
}

.chat-item.persona-custom {
    transition: border-left-color 0.3s ease;
}

.persona-icon-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 8px;
    font-size: 1.4em;
    border-radius: 6px;
    line-height: normal;
    flex-shrink: 0;
}

.persona-info div {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.persona-info strong {
    display: block;
    line-height: 1.2;
    margin-bottom: 0;
}

.emoji-picker {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    height: 200px;
    background: #1a1b26;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 100;
    padding: 0.75rem;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
    backdrop-filter: blur(10px);
}

.emoji-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.emoji-picker::-webkit-scrollbar {
    width: 6px;
}

.emoji-picker::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.emoji-picker::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.mermaid-wrapper {
    margin: 1rem 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
}

.mermaid-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.mermaid-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.copy-mermaid-btn,
.reset-zoom-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-mermaid-btn:hover,
.reset-zoom-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.mermaid {
    background: transparent !important;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    width: 100%;
    max-height: 750px;
    overflow: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    transition: max-height 0.3s ease;
    cursor: grab;
}

.mermaid:active {
    cursor: grabbing;
}

.mermaid::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.mermaid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.mermaid-placeholder {
    width: 100%;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.mermaid svg {
    max-width: 100%;
    height: auto;
    overflow: visible !important;
}

.mermaid {
    display: block !important;
    text-align: center;
}

.mermaid svg {
    display: inline-block;
}

.mermaid .cluster rect,
.mermaid .subgraph-level-0 rect,
.mermaid .subgraph-level-n rect,
.mermaid g[id^="cluster"] rect,
.mermaid .cluster path {
    fill: rgba(255, 255, 255, 0.05) !important;
    stroke: rgba(255, 255, 255, 0.2) !important;
    stroke-width: 1px !important;
    rx: 12px !important;
}

.mermaid .cluster text,
.mermaid .cluster-label text,
.mermaid .cluster-label span,
.mermaid .cluster-label div,
.mermaid g[id^="cluster"] text,
.mermaid g[id^="cluster"] foreignObject div {
    fill: var(--text-secondary) !important;
    color: var(--text-secondary) !important;
    background: transparent !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    font-size: 11px !important;
    line-height: 1.5 !important;
    padding: 2px 4px !important;
    display: inline-block !important;
    overflow: visible !important;
    width: auto !important;
}

.mermaid g[id^="cluster"] foreignObject {
    overflow: visible !important;
}

.mermaid g.cluster>rect,
.mermaid .cluster rect,
.mermaid g[id^="cluster"]>rect,
.mermaid .subgraph-level-0 rect {
    fill-opacity: 0.1 !important;
}

.suggestion-pills-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    padding: 2rem;
    animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-welcome {
    text-align: center;
    margin-bottom: 2.5rem;
}

.suggestion-avatar {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.25rem auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.suggestion-welcome h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.suggestion-welcome p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.suggestion-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    max-width: 700px;
    width: 100%;
}

.suggestion-pill {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.suggestion-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.suggestion-pill:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.pill-icon {
    font-size: 1.1rem;
}

.pill-text {
    white-space: nowrap;
}

@media (max-width: 600px) {
    .suggestion-pills {
        flex-direction: column;
        align-items: center;
    }

    .suggestion-pill {
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .suggestion-welcome h2 {
        font-size: 1.4rem;
    }

    .suggestion-avatar {
        width: 56px;
        height: 56px;
        font-size: 1.75rem;
    }
}

.rowUser,
.rowAssistant {
    position: relative;
    padding-bottom: 0.75rem;
}

.message-actions {
    position: absolute;
    bottom: -4px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.rowUser .message-actions {
    right: 0;
}

.rowAssistant .message-actions {
    left: 48px;
}

.rowUser:hover .message-actions,
.rowAssistant:hover .message-actions {
    opacity: 1;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.action-btn svg {
    width: 13px;
    height: 13px;
}

.edit-message-textarea {
    width: 100%;
    min-height: 120px;
    max-height: 300px;
    padding: 1rem;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.edit-message-textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(242, 81, 27, 0.2);
}

.main-wrapper {
    display: flex;
    width: calc(100dvw - 260px);
    margin-left: 260px;
    height: 100dvh;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-wrapper .container {
    flex: 1;
    min-width: 0;
    margin-left: 0;
}

.main-wrapper.canvas-open .container {
    flex: 0 0 auto;
}

.canvas-container {
    display: flex;
    flex-direction: column;
    background: var(--main-bg);
    border-left: 1px solid var(--glass-border);
    height: 100dvh;
    overflow: hidden;
    width: 0;
    opacity: 0;
}

.main-wrapper.canvas-open .canvas-container {
    flex: 1;
    opacity: 1;
    overflow: auto;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.canvas-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.canvas-actions {
    display: flex;
    gap: 0.5rem;
}

.canvas-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.canvas-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

#canvasFrame {
    flex: 1;
    width: 100%;
    height: 100%;
    max-height: calc(100dvh - 50px);
    border: none;
    background: #ffffff;
    overflow: auto;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #282c34;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-block-lang {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.code-block-buttons {
    display: flex;
    gap: 0.5rem;
}

.code-header-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-header-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.code-header-btn svg {
    width: 14px;
    height: 14px;
}

.code-header-btn.preview-btn:hover {
    color: var(--accent-color);
}

.code-block-wrapper pre {
    border-radius: 0 0 8px 8px !important;
    margin: 0 !important;
}

.code-block-wrapper pre code {
    border-radius: 0 0 8px 8px !important;
}

.main-wrapper.canvas-open:not(.canvas-closing) .messages {
    padding: 0.5rem;
}

.main-wrapper.canvas-open:not(.canvas-closing) .rowAssistant .avatar {
    width: 0;
    min-width: 0;
    opacity: 0;
    margin: 0;
    transform: translateX(-10px);
}

.main-wrapper.canvas-open:not(.canvas-closing) .rowAssistant {
    gap: 0;
}

.main-wrapper.canvas-open:not(.canvas-closing) .message {
    max-width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.main-wrapper.canvas-open:not(.canvas-closing) .form-group {
    padding: 0.5rem;
}

.main-wrapper.canvas-open:not(.canvas-closing) .rowAssistant .message-actions {
    left: 0;
}

.rowAssistant .message table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.rowAssistant .message th {
    text-align: left;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border-bottom: 2px solid var(--glass-border);
    font-weight: 600;
    color: var(--text-primary);
}

.rowAssistant .message td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    vertical-align: top;
    line-height: 1.5;
}

.rowAssistant .message tr:last-child td {
    border-bottom: none;
}

.rowAssistant .message td:first-child {
    font-weight: 500;
    color: var(--text-primary);
    width: 30%;
}

@media (max-width: 1024px) {
    .main-wrapper.canvas-open .container {
        flex: 0 0 35%;
        max-width: 35%;
    }

    .main-wrapper.canvas-open .canvas-container {
        flex: 0 0 65%;
        max-width: 65%;
    }
}

@media (max-width: 768px) {
    .main-wrapper.canvas-open {
        flex-direction: column;
    }

    .main-wrapper.canvas-open .container {
        flex: 0 0 50%;
        max-width: 100%;
    }

    .main-wrapper.canvas-open .canvas-container {
        flex: 0 0 50%;
        max-width: 100%;
        height: 50dvh;
    }
}