.guest-limit-notice {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding: 8px 10px 8px 13px;
    border: 1px solid rgba(245, 92, 30, 0.28);
    border-radius: 12px;
    background: rgba(245, 92, 30, 0.07);
    color: var(--text-1);
    font-size: 12px;
}
.guest-limit-notice:not(.hidden) {
    display: flex;
}
.guest-limit-copy {
    min-width: 0;
    color: var(--text-2);
    line-height: 1.35;
}
.guest-limit-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 0 0 auto;
}
.guest-limit-actions a {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 7px;
    background: var(--accent);
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.guest-limit-actions .guest-limit-login {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(245, 92, 30, 0.35);
}
body.guest-limit-reached .composer {
    opacity: .55;
}
@media (max-width: 640px) {
    .guest-limit-notice {
        align-items: flex-start;
        flex-direction: column;
    }
    .guest-limit-actions {
        width: 100%;
    }
}
.cookie-consent {
    position: fixed;
    left: 22px;
    right: 22px;
    bottom: 20px;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 12px 34px rgba(0, 0, 0, .16);
    transform: translateY(140%);
    transition: transform .25s ease;
}
.cookie-consent.visible { transform: translateY(0); }
.cookie-consent div { display: grid; gap: 3px; }
.cookie-consent strong { font-size: 13px; color: var(--text-1); }
.cookie-consent span { font-size: 12px; line-height: 1.45; color: var(--text-2); }
.cookie-consent button {
    flex: 0 0 auto;
    border: 0;
    border-radius: 8px;
    padding: 9px 15px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
@media (max-width: 640px) {
    .cookie-consent { left: 12px; right: 12px; bottom: 12px; align-items: flex-start; }
}
* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}
button {
    font-family: inherit;
}
textarea {
    font-family: inherit;
    width: 100%;
}
.scrollable {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll) transparent;
}
.scrollable::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.scrollable::-webkit-scrollbar-thumb {
    background: var(--scroll);
    border-radius: 8px;
    border: 3px solid transparent;
    background-clip: content-box;
}
.scrollable::-webkit-scrollbar-track {
    background: transparent;
}
a {
    color: var(--accent);
}
a:hover {
    opacity: 0.8;
}
@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(7px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
@keyframes waveDance {
    0%,
    100% {
        transform: scaleY(0.32);
    }
    50% {
        transform: scaleY(1);
    }
}
@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.22;
    }
}
@keyframes dot {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}
@keyframes recdot {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.25;
    }
}

#app {
    height: 100vh;
    width: 100%;
    display: flex;
    position: relative;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
}

.sidebar {
    width: 284px;
    flex: 0 0 284px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
}
#app.narrow .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 45;
    transform: translateX(-104%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}
#app.narrow.sidebar-open .sidebar {
    transform: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 40;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s;
}
#app.narrow.sidebar-open .scrim {
    opacity: 1;
    pointer-events: auto;
}
.brand {
    padding: 16px 14px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    color: var(--accent-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 17px;
    flex: 0 0 auto;
    overflow: hidden;
}
.brand-name {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.01em;
}
.accent-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    border-radius: 14px;
    padding: 11px 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s;
}
.accent-btn:hover {
    transform: translateY(-1px);
}
.lib-nav {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 9px 11px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
    background: transparent;
    color: var(--text-2);
}
.lib-nav:hover {
    background: var(--surface-2);
}
.lib-nav.active {
    background: var(--surface-2);
    color: var(--text);
    border-color: transparent;
}
.lib-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
    background: var(--surface-2);
    border-radius: 999px;
    padding: 2px 8px;
    flex: 0 0 auto;
}
.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-2);
    border-radius: 11px;
    padding: 8px 11px;
}
.search-box input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13.5px;
    color: var(--text);
    width: 100%;
}
.group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-3);
    padding: 6px 10px 6px;
}
.conv-row {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    text-align: left;
    border: none;
    border-radius: 11px;
    padding: 9px 10px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
    margin-bottom: 2px;
    background: transparent;
    color: var(--text-2);
}
.conv-row:hover {
    background: var(--surface-2);
}
.conv-row.active {
    background: var(--surface-2);
    color: var(--text);
}
.conv-row span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}
.conv-wrap {
    position: relative;
}
.conv-dots {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--text-3);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.conv-row:hover .conv-dots,
.conv-row.active .conv-dots,
.conv-dots.open {
    display: flex;
}
.conv-dots:hover {
    background: var(--surface-2);
    color: var(--text);
}
.conv-menu {
    position: absolute;
    right: 6px;
    top: 38px;
    z-index: 25;
    width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
    padding: 5px;
}
.conv-menu button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}
.conv-menu button:hover {
    background: var(--surface-2);
}
.conv-menu button.danger {
    color: var(--danger);
}
.rename-input {
    width: 100%;
    border: 1.5px solid var(--accent);
    border-radius: 11px;
    padding: 8px 10px;
    font-size: 13.5px;
    font-weight: 600;
    background: var(--surface);
    color: var(--text);
    outline: none;
    margin-bottom: 2px;
    font-family: inherit;
}
.sidebar-foot {
    position: relative;
    border-top: 1px solid var(--border);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.settings-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-3);
    flex: 0 0 auto;
    transition: background 0.12s;
}
.settings-btn:hover {
    background: var(--surface-2);
}
.settings-menu {
    position: absolute;
    bottom: calc(100% - 4px);
    right: 12px;
    width: 230px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18);
    padding: 6px;
    z-index: 30;
}
.settings-row {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: none;
    border-radius: 9px;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: background 0.12s;
}
.settings-row:hover {
    background: var(--surface-2);
}
.settings-row .mi-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
}
.settings-row .mi-label {
    flex: 1;
    text-align: left;
}
.settings-row .mi-hint {
    font-size: 11.5px;
    color: var(--text-3);
    flex: 0 0 auto;
}
.settings-row.danger {
    color: var(--danger);
}

.topbar {
    height: 60px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.ghost-btn {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    flex: 0 0 auto;
    transition: background 0.12s;
}
.ghost-btn:hover {
    background: var(--surface-2);
}
.topbar-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.model-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 11px;
    cursor: pointer;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    transition: background 0.12s;
}
.model-btn:hover {
    background: var(--surface-2);
}
.model-menu {
    position: absolute;
    right: 0;
    top: 46px;
    width: 238px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.18);
    padding: 6px;
    z-index: 30;
}
.model-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.12s;
}
.model-row:hover,
.model-row.active {
    background: var(--surface-2);
}

.view {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
}
.msg-list {
    flex: 1;
    overflow-y: auto;
    position: relative;
}
.empty-hero {
    max-width: 720px;
    margin: 0 auto;
    padding: 8vh 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.key-warning {
    margin-top: 20px;
    background: var(--warn-bg);
    border: 1px solid var(--warn-border);
    color: var(--warn-text);
    border-radius: 13px;
    padding: 11px 15px;
    font-size: 13px;
    line-height: 1.5;
    text-align: left;
}
.sugg-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    width: 100%;
}
.sugg-tab {
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s;
}
.sugg-tab.active {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: transparent;
}
.sugg-tab:hover:not(.active) {
    background: var(--surface-2);
}
.sugg-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
    width: 100%;
}
.sugg-card {
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 15px 16px;
    cursor: pointer;
    transition:
        transform 0.12s,
        border-color 0.12s;
}
.sugg-card:hover {
    transform: translateY(-2px);
    border-color: var(--text-3);
}
.messages {
    max-width: 760px;
    margin: 0 auto;
    padding: 26px 0 12px;
}
.msg-bot {
    display: flex;
    gap: 13px;
    padding: 0 var(--pad-list);
    margin-bottom: var(--gap-msg);
    animation: msgIn 0.3s ease;
}
.msg-bot .avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    flex: 0 0 auto;
    margin-top: 2px;
}
.bot-bubble {
    background: var(--bot-bubble);
    border: 1px solid var(--bot-border);
    border-radius: var(--radius-bubble);
    border-top-left-radius: 6px;
    padding: var(--bubble-pad);
}
.intent-badge {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    margin-bottom: 8px;
}
.video-pending {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--surface-2);
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-2);
    margin-top: 4px;
}
.video-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.studio-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 18px;
    background: var(--surface-2);
    border-radius: 12px;
    margin-top: 4px;
}
.studio-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-3);
}
.studio-step .studio-mark {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.studio-step.studio-running {
    color: var(--text);
    font-weight: 600;
}
.studio-step.studio-done {
    color: var(--text-2);
}
.studio-step.studio-done .studio-mark {
    color: var(--accent);
}
.studio-step.studio-failed .studio-mark {
    color: #e5484d;
}
.bot-text {
    font-size: 14.5px;
    line-height: 1.62;
    word-break: break-word;
    color: var(--text);
}
.bot-text > *:first-child {
    margin-top: 0;
}
.bot-text > *:last-child {
    margin-bottom: 0;
}
.bot-text p {
    margin: 0 0 10px;
}
.bot-text h1,
.bot-text h2,
.bot-text h3 {
    margin: 16px 0 8px;
    line-height: 1.35;
    font-weight: 700;
}
.bot-text h1 {
    font-size: 19px;
}
.bot-text h2 {
    font-size: 17px;
}
.bot-text h3 {
    font-size: 15.5px;
}
.bot-text ul,
.bot-text ol {
    margin: 0 0 10px;
    padding-left: 22px;
}
.bot-text li {
    margin: 3px 0;
}
.bot-text li > p {
    margin: 0;
}
.bot-text blockquote {
    margin: 0 0 10px;
    padding: 2px 14px;
    border-left: 3px solid var(--border);
    color: var(--text-2);
}
.bot-text a {
    color: var(--accent);
    text-decoration: underline;
}
.bot-text strong {
    font-weight: 700;
}
.bot-text em {
    font-style: italic;
}
.bot-text code {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.88em;
    background: var(--surface-2);
    border-radius: 4px;
    padding: 1px 5px;
}
.bot-text hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 14px 0;
}
.bot-img-card {
    max-width: 100%;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    margin: 10px 0 4px;
}
.bot-img-card img {
    display: block;
    width: 100%;
    height: auto;
}
.code-block {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0 4px;
    background: var(--code-bg);
}
.code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 11px;
    background: var(--code-head);
    border-bottom: 1px solid var(--border);
}
.code-lang {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
}
.copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 7px;
}
.copy-btn:hover {
    background: var(--surface-2);
}
.code-block pre {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    font-family: "JetBrains Mono", monospace;
    font-size: 13px;
    line-height: 1.55;
    color: var(--code-text);
}
.quote-block {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin: 10px 0 4px;
    background: var(--surface-2);
}
.quote-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 11px;
    border-bottom: 1px solid var(--border);
}
.quote-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
}
.quote-block blockquote {
    margin: 0;
    padding: 12px 14px;
    border-left: 3px solid var(--accent);
    color: var(--text);
}
.dots {
    display: flex;
    gap: 5px;
    padding: 4px 2px;
}
.dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-3);
    animation: dot 1.2s infinite;
}
.dots span:nth-child(2) {
    animation-delay: 0.18s;
}
.dots span:nth-child(3) {
    animation-delay: 0.36s;
}
.caret {
    display: inline-block;
    width: 8px;
    height: 15px;
    background: var(--accent);
    border-radius: 2px;
    margin-left: 1px;
    vertical-align: -2px;
    animation: blink 1s steps(2) infinite;
}
.msg-user {
    display: flex;
    justify-content: flex-end;
    padding: 0 var(--pad-list);
    margin-bottom: var(--gap-msg);
    animation: msgIn 0.3s ease;
}
.msg-user-inner {
    max-width: 80%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.user-bubble {
    background: var(--accent);
    color: var(--accent-fg);
    border-radius: var(--radius-bubble);
    border-top-right-radius: 6px;
    padding: var(--bubble-pad);
    font-size: 14.5px;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}
.msg-actions {
    display: flex;
    gap: 2px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}
.msg-user:hover .msg-actions,
.msg-bot:hover .msg-actions {
    opacity: 1;
}
.msg-act-btn {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.12s;
}
.msg-act-btn:hover {
    background: var(--surface-2);
    color: var(--text);
}
.file-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}
.file-img-card {
    width: 110px;
    height: 110px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
}
.file-doc-card {
    border-radius: 13px;
    border: 1px solid var(--border);
    background: var(--surface);
    overflow: hidden;
}
.file-doc-inner {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
}
.file-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--text-2);
}
.thumb-cover {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
}

.composer-wrap {
    flex: 0 0 auto;
    padding: 6px 16px 16px;
    background: var(--bg);
}
.composer-inner {
    max-width: 760px;
    margin: 0 auto;
}
.att-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.img-opts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin-bottom: 10px;
    padding: 9px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}
.img-opts-group {
    display: flex;
    align-items: center;
    gap: 7px;
}
.img-opts-label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.img-opts .field-chip {
    padding: 4px 11px;
}
.att-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}
.att-thumb {
    width: 72px;
    height: 72px;
    background-size: cover;
    background-position: center;
}
.att-doc {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 30px 10px 11px;
}
.att-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--text-2);
}
.att-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: var(--overlay-btn);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.composer {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.05);
    padding: 7px 8px;
}
.composer-line {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-2);
    flex: 0 0 auto;
    transition: background 0.12s;
}
.icon-btn:hover {
    background: var(--surface-2);
}
.icon-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.icon-btn:disabled:hover {
    background: transparent;
}
#input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    resize: none;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    padding: 9px 4px;
    max-height: 160px;
    min-height: 24px;
}
.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    background: var(--surface-2);
    color: var(--text-3);
    cursor: default;
    transition:
        background 0.15s,
        opacity 0.15s;
    opacity: 0.8;
}
.send-btn.can-send {
    background: var(--accent);
    color: var(--accent-fg);
    cursor: pointer;
    opacity: 1;
}
.send-btn.out-of-credits {
    background: var(--surface-2);
    color: var(--text-3);
    cursor: not-allowed;
    opacity: 0.5;
}
.rec-line {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 4px;
}
.rec-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--danger);
    flex: 0 0 auto;
    animation: recdot 1s infinite;
}
.rec-wave {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 2px;
    height: 34px;
    overflow: hidden;
}
.rec-wave span {
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
    flex: 0 0 auto;
    transform-origin: center;
    animation: waveDance 0.9s ease-in-out infinite;
}
.rec-time {
    font-variant-numeric: tabular-nums;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-2);
    flex: 0 0 auto;
}
.rec-done {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: var(--accent-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}
.mic-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.stt-lang-btn {
    height: 22px;
    min-width: 27px;
    padding: 0 5px;
    margin-left: -2px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: background 0.12s;
}
.stt-lang-btn:hover {
    background: var(--surface-2);
}
.stt-lang-menu {
    right: 0;
    top: auto;
    bottom: 48px;
    width: 190px;
}
#micBtn.listening {
    color: var(--danger);
    background: var(--surface-2);
}
#micBtn.listening svg {
    animation: recdot 1s infinite;
}
.composer-hint {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-3);
    margin-top: 9px;
}

.lib-filters {
    padding: 16px var(--pad-list) 4px;
    flex: 0 0 auto;
}
.lib-filters-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filter-pill {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
    background: var(--surface);
    color: var(--text-2);
}
.filter-pill.active {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: transparent;
}
.lib-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px var(--pad-list) 28px;
}
.lib-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
    gap: 16px;
}
.lib-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}
.lib-thumb {
    position: relative;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-2);
    background-image: repeating-linear-gradient(
        45deg,
        rgba(128, 128, 128, 0.1) 0 9px,
        transparent 9px 18px
    );
}
.lib-thumb.openable {
    cursor: pointer;
}
.lib-thumb-vid {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    background: #000;
}
.type-badge {
    position: absolute;
    top: 9px;
    left: 9px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--overlay-btn);
    color: #ffffff;
    border-radius: 999px;
    padding: 4px 9px 4px 7px;
    font-size: 11px;
    font-weight: 600;
}
.lib-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 6px;
}
.lib-act-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--overlay-btn);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.lib-caption {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: var(--text-3);
    letter-spacing: 0.02em;
}
.lib-empty {
    max-width: 1000px;
    margin: 0 auto;
    padding: 64px 16px;
    text-align: center;
    color: var(--text-3);
}

.drag-overlay {
    position: absolute;
    inset: 0;
    z-index: 60;
    background: rgba(0, 0, 0, 0.42);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.drag-box {
    width: 100%;
    max-width: 520px;
    border: 2.5px dashed var(--accent-fg);
    border-radius: 24px;
    padding: 48px 24px;
    text-align: center;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
}
.preview-scrim {
    position: absolute;
    inset: 0;
    z-index: 80;
    background: rgba(0, 0, 0, 0.74);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
}
.preview-modal {
    max-width: 860px;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}
.preview-stage {
    position: relative;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-close {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--overlay-btn);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.preview-img {
    width: 100%;
    height: 66vh;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.preview-ph {
    width: 100%;
    height: 56vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(128, 128, 128, 0.1) 0 16px,
        transparent 16px 32px
    );
}
.preview-foot {
    flex: 0 0 auto;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--border);
}
.confirm-scrim {
    position: absolute;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.5);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.confirm-box {
    max-width: 400px;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px 22px 18px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}
.account-box {
    max-width: 480px;
    padding: 22px;
}
.account-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}
.account-header .ghost-btn {
    margin-left: auto;
}
.account-details {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.account-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 0;
}
.account-detail-label {
    font-size: 12px;
    color: var(--text-3);
}
.account-detail-value {
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    color: var(--text);
}
.account-plan-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 18px;
}
.account-plan-name {
    font-size: 16px;
    font-weight: 700;
    margin-top: 4px;
    text-transform: capitalize;
}
.account-credits {
    text-align: right;
}
.account-credits strong {
    display: block;
    font-family: "JetBrains Mono", monospace;
    font-size: 15px;
    margin-top: 4px;
    color: var(--accent);
}
.account-edit-btn {
    width: 100%;
    margin-top: 20px;
}
.account-edit-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.account-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-2);
}
.account-field em {
    font-style: normal;
    font-weight: 400;
    color: var(--text-3);
    margin-left: 4px;
}
.account-field input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 11px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    outline: none;
}
.account-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.account-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}
.account-form-actions button {
    flex: 1;
}
.account-form-error {
    padding: 9px 11px;
    border-radius: 9px;
    background: var(--danger-subtle);
    color: var(--danger);
    font-size: 12px;
    line-height: 1.45;
}
.confirm-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--danger-subtle);
    color: var(--danger);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.confirm-cancel {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: background 0.12s;
}
.confirm-cancel:hover {
    background: var(--surface-2);
}
.confirm-run {
    flex: 1;
    background: var(--danger);
    border: none;
    border-radius: 12px;
    padding: 11px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    color: #ffffff;
    transition: background 0.12s;
}
.confirm-run:hover {
    background: var(--danger-hover);
}

.picker-scrim {
    position: absolute;
    inset: 0;
    z-index: 75;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.picker-modal {
    max-width: 720px;
    width: 100%;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}
.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.pick-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    transition:
        border-color 0.12s,
        box-shadow 0.12s;
}
.pick-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}
.pick-thumb {
    position: relative;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface-2);
    background-image: repeating-linear-gradient(
        45deg,
        rgba(128, 128, 128, 0.1) 0 9px,
        transparent 9px 18px
    );
}
.pick-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--overlay-btn);
    color: #ffffff;
    border-radius: 999px;
    padding: 3px 8px 3px 6px;
    font-size: 10.5px;
    font-weight: 600;
}
.pick-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pick-preview {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: var(--overlay-btn);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}
.pick-check .on {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-fg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pick-check .off {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    background: rgba(0, 0, 0, 0.35);
}
.pick-add {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    border-radius: 12px;
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    flex: 0 0 auto;
    transition: opacity 0.12s;
}
.pick-add:disabled {
    opacity: 0.5;
    cursor: default;
}
.picker-cancel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 9px 16px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    flex: 0 0 auto;
    transition: background 0.12s;
}
.picker-cancel:hover {
    background: var(--surface-2);
}
.hidden {
    display: none !important;
}

/* ============ classes tách từ inline style trong HTML (chat.blade.php) ============ */
.file-input-hidden {
    display: none;
}

.pad-newchat {
    padding: 8px 14px 6px;
}
.w-full {
    width: 100%;
}
.pad-nav-item {
    padding: 0 14px 10px;
}
.flex-none {
    flex: 0 0 auto;
}
.flex1-left {
    flex: 1;
    text-align: left;
}
.conv-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 8px;
}
.user-avatar-32 {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-2);
}
.flex1-minw0 {
    flex: 1;
    min-width: 0;
}
.user-name-label {
    font-size: 13.5px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-plan-label {
    font-size: 11.5px;
    color: var(--text-3);
}
.m0 {
    margin: 0;
}
.main-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
}
.model-wrap-pos {
    position: relative;
    flex: 0 0 auto;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    flex: 0 0 auto;
}
.opacity-60 {
    opacity: 0.6;
}
.credits-chip-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--surface-2);
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
}
.credits-unit {
    opacity: 0.6;
    font-weight: 500;
}
.hero-icon-56 {
    width: 56px;
    height: 56px;
    border-radius: 17px;
    background: var(--accent);
    color: var(--accent-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 26px;
    margin-bottom: 18px;
    overflow: hidden;
}
.hero-fill-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.hero-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.hero-subtitle {
    font-size: 15px;
    color: var(--text-2);
    margin-top: 8px;
    max-width: 440px;
}
.lib-empty-icon {
    margin-bottom: 12px;
    opacity: 0.7;
}
.empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-2);
}
.empty-sub {
    font-size: 13px;
    margin-top: 4px;
}
.drag-icon {
    margin-bottom: 14px;
}
.drag-title {
    font-size: 20px;
    font-weight: 700;
}
.drag-sub {
    font-size: 14px;
    opacity: 0.85;
    margin-top: 6px;
}
.preview-title-text {
    font-size: 15px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.meta-sub-2 {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 2px;
}
.download-btn-pad {
    padding: 9px 15px;
    font-size: 13.5px;
    border-radius: 12px;
    text-decoration: none;
}
.picker-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}
.picker-title {
    font-size: 15.5px;
    font-weight: 700;
}
.picker-body-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}
.picker-empty-pad {
    padding: 36px 16px;
}
.picker-empty-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
}
.picker-empty-sub {
    font-size: 12.5px;
    margin-top: 4px;
}
.picker-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
}
.pick-count-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-2);
}
.sys-box-width {
    max-width: 540px;
}
.sugg-modal-width {
    max-width: 560px;
}
#suggScrim {
    z-index: 74;
}
.sugg-field {
    margin-bottom: 16px;
}
.sugg-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}
.sugg-field input,
.sugg-field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 13.5px;
    line-height: 1.5;
    background: var(--surface);
    color: var(--text);
    outline: none;
    font-family: inherit;
    resize: vertical;
}
.sugg-field textarea {
    min-height: 72px;
}
.sugg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}
.field-chip {
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.12s,
        color 0.12s,
        border-color 0.12s;
}
.field-chip:hover {
    background: var(--surface);
}
.field-chip.active {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: transparent;
}
.gloss-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.gloss-row input {
    flex: 1;
}
.gloss-add {
    flex: 0 0 auto;
    width: 38px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    border-radius: 12px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s;
}
.gloss-add:hover {
    background: var(--surface);
}
.gloss-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.gloss-list:empty {
    margin-top: 0;
}
.gloss-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 6px 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.gloss-chip button {
    border: none;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 0 4px;
    border-radius: 999px;
}
.gloss-chip button:hover {
    color: var(--text);
}
.sugg-attach-section {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 4px;
}
.sugg-attach-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}
.sugg-attach-btns {
    display: flex;
    gap: 8px;
}
.sugg-attach-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: background 0.12s;
}
.sugg-attach-btn:hover {
    background: var(--surface);
}
.sugg-sys-section {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    margin-top: 16px;
}
.sugg-sys-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
}
.sugg-sys-caret {
    transition: transform 0.15s;
    color: var(--text-3);
}
.sugg-sys-toggle.open .sugg-sys-caret {
    transform: rotate(90deg);
}
.sugg-sys-hint {
    font-size: 12px;
    color: var(--text-3);
    line-height: 1.5;
    margin-top: 10px;
}
.sugg-sys-textarea {
    min-height: 180px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}
.confirm-title-text {
    font-size: 16.5px;
    font-weight: 700;
}
.sys-desc {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 4px;
    line-height: 1.5;
}
.sys-textarea {
    width: 100%;
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13.5px;
    line-height: 1.5;
    background: var(--surface);
    color: var(--text);
    resize: vertical;
    outline: none;
}
.sys-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}
.confirm-run-accent {
    background: var(--accent);
    color: var(--accent-fg);
}
.confirm-header {
    display: flex;
    align-items: center;
    gap: 13px;
}
.confirm-message {
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--text-2);
    margin-top: 14px;
}
.confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

/* ============ Feature 1: @suggest autocomplete ============ */
.sugg-autocomplete {
    position: absolute;
    bottom: 100%;
    left: 4px;
    z-index: 50;
    width: 320px;
    max-height: 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
    padding: 6px;
}
.sugg-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.1s;
}
.sugg-autocomplete-item:hover,
.sugg-autocomplete-item.active {
    background: var(--surface-2);
}
.sugg-autocomplete-item .sugg-ach-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    color: var(--text-2);
}
.sugg-autocomplete-item .sugg-ach-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}
.sugg-autocomplete-item .sugg-ach-sub {
    font-size: 11px;
    color: var(--text-3);
    margin-top: 1px;
}

/* ============ Feature 2: AI suggestion chips ============ */
.ai-sugg-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 0 4px;
}
.ai-sugg-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: 100%;
    margin-bottom: 2px;
}
.ai-sugg-chip {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.12s,
        color 0.12s,
        border-color 0.12s;
    text-align: left;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-sugg-chip:hover {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: transparent;
}

/* ============ Feature 3: Save as suggestion ============ */
.save-sugg-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-2);
    transition: background 0.12s;
    flex: 0 0 auto;
}
.save-sugg-btn:hover {
    background: var(--surface-2);
}
#suggSaveBar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}
#suggSaveBar.hidden {
    display: none;
}

/* ============ Feature 6: Multi-step ============ */
.step-indicators {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 0 2px;
}
.step-dot {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    transition: background 0.2s;
}
.step-dot.active {
    background: var(--accent);
}
.step-dot.done {
    background: var(--accent);
    opacity: 0.5;
}
.step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    margin-bottom: 6px;
}
.step-nav {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}
.step-nav-btn {
    border: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 10px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: background 0.12s;
}
.step-nav-btn:hover {
    background: var(--surface);
}
.step-nav-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

/* ============ Feature 7: Partial insert ============ */
.field-insert-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
    transition: background 0.12s;
    padding: 0;
    margin-left: 6px;
}
.field-insert-btn:hover {
    background: var(--surface);
    color: var(--text);
}
.sugg-field .field-header {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}
.sugg-field .field-header label {
    flex: 1;
    margin-bottom: 0;
}

/* ============ Usage view (Sử dụng credit) ============ */
.usage-body {
    max-width: 760px;
    margin: 0 auto;
    padding: 22px 18px 40px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.usage-loading {
    color: var(--text-3);
    font-size: 13px;
    padding: 8px 0;
}
.usage-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.usage-tile {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
}
.usage-tile-label {
    font-size: 12px;
    color: var(--text-3);
    margin-bottom: 6px;
}
.usage-tile-num {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}
.usage-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}
.usage-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 12px;
}
.usage-chart {
    width: 100%;
    height: auto;
    display: block;
}
.usage-bar {
    fill: var(--accent);
}
.usage-bar.empty {
    fill: var(--border);
}
.usage-chart-axis {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-3);
    margin-top: 4px;
}
.usage-intent-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 12.5px;
}
.usage-intent-name {
    width: 110px;
    flex: 0 0 auto;
    color: var(--text-2);
}
.usage-intent-track {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    overflow: hidden;
}
.usage-intent-fill {
    display: block;
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
}
.usage-intent-val {
    flex: 0 0 auto;
    color: var(--text-3);
    font-size: 12px;
    min-width: 90px;
    text-align: right;
}
.usage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
.usage-table th {
    text-align: left;
    color: var(--text-3);
    font-weight: 600;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}
.usage-table td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
}
.usage-neg {
    color: #e0503a;
    font-weight: 600;
}
.usage-pos {
    color: #32a060;
    font-weight: 600;
}

/* ============ Cảnh báo credit thấp ============ */
.credits-chip-inline.credits-low {
    background: rgba(245, 92, 30, 0.14);
    color: var(--accent);
}
.low-credit-banner {
    position: fixed;
    bottom: 22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    background: var(--surface-2);
    border: 1px solid var(--accent);
    color: var(--text);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.low-credit-close {
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    font-size: 13px;
    padding: 2px;
}

/* ============ Nút "Chỉnh sửa ảnh" trên ảnh bot ============ */
.bot-img-card {
    position: relative;
}
.img-edit-btn {
    position: absolute;
    right: 10px;
    bottom: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    border-radius: 9px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.62);
    color: #fff;
    opacity: 0;
    transition: opacity 0.15s;
}
.bot-img-card:hover .img-edit-btn,
.img-edit-btn:focus-visible {
    opacity: 1;
}
.img-edit-btn:hover {
    background: var(--accent);
}
@media (hover: none) {
    .img-edit-btn {
        opacity: 1;
    }
}

/* ============ Kiến thức (RAG) ============ */
.kb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.kb-head-text {
    font-size: 13.5px;
    color: var(--text-2);
    max-width: 560px;
}
.kb-card { margin-bottom: 14px; }
.kb-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.kb-desc {
    font-size: 12.5px;
    color: var(--text-3);
    margin-top: 2px;
}
.kb-card-actions {
    display: flex;
    gap: 6px;
    flex: 0 0 auto;
}
.kb-doc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-top: 1px solid var(--border);
    font-size: 13.5px;
}
.kb-doc-title {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kb-doc-size {
    font-size: 12px;
    color: var(--text-3);
    flex: 0 0 auto;
}
.kb-doc-err { cursor: help; color: #e5484d; }
.kb-doc-empty {
    font-size: 13px;
    color: var(--text-3);
    padding: 6px 0;
}
.kb-badge {
    font-size: 11.5px;
    font-weight: 600;
    padding: 2px 9px;
    border-radius: 99px;
    flex: 0 0 auto;
}
.kb-pending { background: rgba(245, 158, 11, .14); color: #d97706; }
.kb-ready { background: rgba(34, 197, 94, .14); color: #16a34a; }
.kb-failed { background: rgba(229, 72, 77, .14); color: #e5484d; }
.kb-attach-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kb-attach-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 13.5px;
}
.kb-attach-row:hover { background: var(--surface-2); }
.kb-attach-name { flex: 1; min-width: 0; }
.kb-attach-count {
    font-size: 12px;
    color: var(--text-3);
}

/* ============ Dự án (workspace) ============ */
.proj-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.proj-add-btn {
    border: none;
    background: none;
    color: var(--text-3);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 6px;
    line-height: 1.2;
}
.proj-add-btn:hover { color: var(--accent); }
.proj-count {
    font-size: 11px;
    color: var(--text-3);
    flex: 0 0 auto;
    margin-left: auto;
}
.proj-empty {
    font-size: 12px;
    color: var(--text-3);
    padding: 2px 10px 6px;
}
.proj-back-row { font-weight: 600; }
.proj-current { display: flex; align-items: center; gap: 6px; }
.proj-name-input {
    width: 100%;
    margin-bottom: 10px;
}
.kb-attach-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-2);
    margin-top: 10px;
}
.proj-move-row {
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text);
    font-family: inherit;
}

/* ============ Trí nhớ dài hạn ============ */
.memory-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.memory-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.memory-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    flex: 0 0 auto;
}
.memory-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.memory-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.memory-row:first-child { border-top: none; }
.memory-content { flex: 1; min-width: 0; }
.memory-date {
    font-size: 11.5px;
    color: var(--text-3);
    flex: 0 0 auto;
}
.memory-clear {
    margin-top: 8px;
    font-size: 12.5px;
    color: #e5484d;
}

/* ============ TTS modal ============ */
.tts-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 12px 0 4px;
}
.tts-fields select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
}
.tts-actions { flex-wrap: wrap; }

/* ============ Ghép video (Thư viện) ============ */
.compose-bar {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: var(--surface);
    font-size: 13.5px;
}
.compose-info { flex: 1; min-width: 180px; }
.compose-audio {
    max-width: 240px;
    padding: 7px 9px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
}
.lib-card.selected { outline: 2px solid var(--accent); border-radius: 14px; }
.sel-order {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-fg);
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.compose-status {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 2;
}
.stt-gen-wrap {
    margin-top: 8px;
}
.stt-gen-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-2);
    color: var(--text-1);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.stt-gen-btn:hover {
    background: var(--accent-bg);
    border-color: var(--accent);
    color: var(--accent);
}
.stt-gen-spinner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text-2);
}
.stt-gen-spinner::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.stt-gen-err {
    display: block;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(220, 38, 38, 0.08);
    color: var(--danger, #dc2626);
    font-size: 12px;
    line-height: 1.4;
}

.conv-summary {
    font-size: 11px;
    color: var(--text-3);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
    margin-left: 20px;
    margin-top: -2px;
    margin-bottom: 4px;
    line-height: 1.3;
}

/* ============ Chọn ảnh bot → tạo video → mở Studio ============ */
.img-sel-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}
.bot-img-card:hover .img-sel-btn,
.img-sel-btn:focus-visible,
.img-sel-btn.checked {
    opacity: 1;
}
.img-sel-btn.checked {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}
.bot-img-card.img-selected {
    outline: 2px solid var(--accent);
    border-radius: 14px;
}
@media (hover: none) {
    .img-sel-btn { opacity: 1; }
}
.img-select-bar {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border: 1px solid var(--accent);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    font-size: 13.5px;
    max-width: calc(100vw - 32px);
}
.img-select-bar.hidden { display: none; }
.img-select-bar .isb-info { color: var(--text); }
