@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #050507;
    --bg-raised: #0e0e11;
    --bg-surface: #18181c;
    --bg-hover: #222228;
    --bg-active: #2a2a32;
    
    --fg: #f0f0f5;
    --fg-muted: #9ca3af;
    --fg-subtle: #6b7280;
    
    --border: rgba(255, 255, 255, 0.05);
    --border-hover: rgba(255, 255, 255, 0.09);
    --border-active: rgba(255, 255, 255, 0.14);
    
    --accent: #3b82f6;
    --accent-soft: rgba(59, 130, 246, 0.1);
    --accent-hover: #2563eb;
    
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.08);
    
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.6;
}

body[data-theme="midnight"] {
    --bg: #020617;
    --bg-raised: #07111f;
    --bg-surface: #0f1b2d;
    --border: rgba(148, 163, 184, 0.12);
}

body[data-theme="graphite"] {
    --bg: #101010;
    --bg-raised: #171717;
    --bg-surface: #202020;
    --border: rgba(255, 255, 255, 0.08);
}

body[data-accent="green"] {
    --accent: #22c55e;
    --accent-soft: rgba(34, 197, 94, 0.12);
    --accent-hover: #16a34a;
}

body[data-accent="amber"] {
    --accent: #f59e0b;
    --accent-soft: rgba(245, 158, 11, 0.13);
    --accent-hover: #d97706;
}

body[data-accent="rose"] {
    --accent: #f43f5e;
    --accent-soft: rgba(244, 63, 94, 0.12);
    --accent-hover: #e11d48;
}

body[data-font-size="small"] {
    font-size: 12px;
}

body[data-font-size="large"] {
    font-size: 14px;
}

body[data-radius="sharp"] {
    --radius-sm: 3px;
    --radius: 5px;
    --radius-lg: 7px;
    --radius-xl: 9px;
}

body[data-radius="round"] {
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
}

body[data-density="compact"] .messages__inner {
    gap: 18px;
}

body[data-density="spacious"] .messages__inner {
    gap: 36px;
}

body[data-animations="off"] *,
body[data-animations="off"] *::before,
body[data-animations="off"] *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

body[data-timestamps="off"] .message-meta span {
    display: none;
}

body[data-header-blur="off"] .chat-header,
body[data-header-blur="off"] .composer {
    backdrop-filter: none;
}

body[data-surface-style="glass"] {
    --bg-raised: rgba(14, 14, 17, 0.82);
    --bg-surface: rgba(24, 24, 28, 0.72);
    --border: rgba(255, 255, 255, 0.08);
}

body[data-surface-style="flat"] {
    --bg-raised: var(--bg);
    --bg-surface: rgba(255, 255, 255, 0.035);
    --border: rgba(255, 255, 255, 0.04);
}

::selection {
    background: rgba(59, 130, 246, 0.25);
    color: #fff;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #27272e;
    border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

/* ---- Layout ---- */
.container {
    width: min(1100px, calc(100% - 40px));
    margin: 0 auto;
}
.container--narrow {
    width: min(680px, calc(100% - 40px));
}

.hidden {
    display: none !important;
}
.full-width {
    width: 100%;
}

/* ---- Buttons ---- */
.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-raised);
    color: var(--fg);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.button:hover {
    background: var(--bg-surface);
    border-color: var(--border-hover);
}

.button:active {
    transform: translateY(0.5px);
}

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

.button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.button.primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.button-danger {
    border-color: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    background: transparent;
}

.button-danger:hover {
    background: var(--danger-soft);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--bg-raised);
    color: var(--fg-subtle);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ---- Header ---- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(5, 5, 7, 0.82);
    backdrop-filter: blur(12px) saturate(1.2);
    border-bottom: 1px solid var(--border);
}

.site-header__inner {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.15s;
}

.logo:hover {
    opacity: 0.8;
}

.logo-mark {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--fg);
    color: var(--bg);
}

.logo-copy strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.logo-copy span {
    display: block;
    color: var(--fg-subtle);
    font-size: 11px;
    line-height: 1.3;
}

.site-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Main / Landing ---- */
.site-main {
    padding: 80px 0 100px;
}

.hero--landing {
    padding-top: 60px;
    text-align: center;
}

.hero-eyebrow {
    display: inline-block;
    margin-bottom: 20px;
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--bg-raised);
    color: var(--fg-subtle);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hero--landing h1 {
    font-size: clamp(36px, 6vw, 68px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    margin-bottom: 20px;
    color: var(--fg);
}

.hero-lead {
    font-size: 17px;
    line-height: 1.7;
    color: var(--fg-muted);
    max-width: 520px;
    margin: 0 auto 28px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ---- Browser Mockup ---- */
.hero-visual {
    margin-top: 64px;
}

.browser-mockup {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-raised);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.browser-mockup__bar {
    height: 38px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
}

.browser-dots {
    display: flex;
    gap: 6px;
}

.browser-dots span {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
}

.browser-address {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: var(--fg-subtle);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 3px 12px;
    max-width: 180px;
    margin: 0 auto;
}

.browser-mockup__body {
    padding: 20px;
    background: var(--bg);
}

.mock-chat {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mock-message {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.mock-message--user {
    justify-content: flex-end;
}

.mock-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--fg);
    flex-shrink: 0;
    margin-top: 2px;
}

.mock-bubble {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 12px;
    border-top-left-radius: 3px;
    padding: 12px 14px;
    min-width: 160px;
    max-width: 320px;
}

.mock-bubble--user {
    border-top-left-radius: 12px;
    border-top-right-radius: 3px;
    background: rgba(59, 130, 246, 0.04);
    border-color: rgba(59, 130, 246, 0.08);
}

.mock-line {
    height: 7px;
    border-radius: 3px;
    background: var(--bg-surface);
    margin-bottom: 7px;
    opacity: 0.5;
}

.mock-line:last-child {
    margin-bottom: 0;
}

.mock-input {
    margin-top: 6px;
    border-top: 1px solid var(--border);
    padding-top: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.mock-input__field {
    flex: 1;
    height: 36px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    padding: 0 14px;
    color: var(--fg-subtle);
    font-size: 12px;
}

.mock-input__btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---- Features ---- */
.section--landing {
    margin-top: 100px;
    padding-top: 48px;
    border-top: 1px solid var(--border);
}

.mini-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.mini-feature {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.mini-feature:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.mini-feature__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fg);
    margin-bottom: 16px;
}

.mini-feature h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--fg);
}

.mini-feature p {
    font-size: 13px;
    color: var(--fg-muted);
    line-height: 1.65;
}

/* ---- Footer ---- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    text-align: center;
    color: var(--fg-subtle);
    font-size: 12px;
}

/* ---- Auth ---- */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-shell {
    width: min(100%, 400px);
}

.auth-card {
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
}

.auth-card h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    text-align: center;
}

.auth-card > p {
    text-align: center;
    color: var(--fg-muted);
    font-size: 14px;
    margin-bottom: 28px;
}

.auth-toggle {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}

.auth-toggle button {
    flex: 1;
    height: 34px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--fg-subtle);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.auth-toggle button.active {
    background: var(--bg-surface);
    border-color: var(--border-hover);
    color: var(--fg);
}

.form-grid {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 6px;
}

.field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--fg-muted);
}

.input-wrap {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input-wrap:focus-within {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.06);
}

.input-wrap input,
.input-wrap textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    font-size: 14px;
}

.input-wrap input {
    height: 44px;
    padding: 0 14px;
}

.input-wrap input::placeholder {
    color: var(--fg-subtle);
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-muted);
    font-size: 13px;
    cursor: pointer;
}

.check input {
    accent-color: var(--accent);
}

.status-box {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid transparent;
}

.status-box.error {
    background: rgba(239, 68, 68, 0.04);
    border-color: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

.status-box.success {
    background: rgba(34, 197, 94, 0.04);
    border-color: rgba(34, 197, 94, 0.15);
    color: #86efac;
}

/* ============================================
   CHAT INTERFACE
   ============================================ */

.chat-shell {
    height: 100vh;
    width: 100vw;
    display: flex;
    overflow: hidden;
    background: var(--bg);
}

body[data-sidebar-position="right"] .chat-shell {
    flex-direction: row-reverse;
}

/* ---- Sidebar ---- */
.chat-sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg-raised);
}

body[data-sidebar-width="compact"] .chat-sidebar {
    width: 268px;
}

body[data-sidebar-width="wide"] .chat-sidebar {
    width: 380px;
}

body[data-sidebar-width="compact"] .chat-item-copy strong {
    max-width: 190px;
}

body[data-sidebar-width="compact"] .chat-item-copy span {
    max-width: 170px;
}

body[data-sidebar-width="wide"] .chat-item-copy strong {
    max-width: 300px;
}

body[data-sidebar-width="wide"] .chat-item-copy span {
    max-width: 270px;
}

body[data-sidebar-position="right"] .chat-sidebar {
    border-right: none;
    border-left: 1px solid var(--border);
}

.chat-sidebar__header {
    height: 56px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
}

.chat-sidebar__section {
    padding: 12px;
    display: grid;
    gap: 8px;
}

.sidebar-action-button {
    justify-content: flex-start;
    background: transparent;
    color: var(--fg-muted);
}

.sidebar-action-button:hover {
    color: var(--fg);
    background: rgba(255, 255, 255, 0.035);
}

.sidebar-action-button.active {
    color: var(--fg);
    background: rgba(255, 255, 255, 0.055);
    border-color: var(--border-hover);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 12px;
}

.chat-list-title {
    padding: 10px 12px 6px;
    color: var(--fg-subtle);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.chat-item {
    position: relative;
    display: flex;
    align-items: stretch;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: background-color 0.12s ease;
}

.chat-item:hover {
    background: rgba(255,255,255,0.025);
}

.chat-item.active {
    background: rgba(59, 130, 246, 0.06);
}

.chat-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--accent);
    border-radius: 2px;
}

body[data-sidebar-position="right"] .chat-item.active::before {
    left: auto;
    right: 0;
}

.chat-item-button {
    flex: 1;
    border: none;
    background: transparent;
    color: inherit;
    text-align: left;
    padding: 10px 12px 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.chat-item-delete {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: var(--fg-subtle);
    border-radius: var(--radius-sm);
    margin: 8px 8px 8px 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.chat-item:hover .chat-item-delete,
.chat-item.active .chat-item-delete {
    opacity: 1;
}

.chat-item-delete:hover {
    background: var(--danger-soft);
    color: #fca5a5;
}

.chat-item-copy strong {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.chat-item-copy span {
    display: block;
    font-size: 12px;
    color: var(--fg-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* dont show more then 30 characters */
    max-width: 200px;
    
}

.chat-sidebar__footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.sidebar-user-trigger {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    border-radius: var(--radius);
    padding: 10px;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sidebar-user-trigger:hover {
    background: rgba(255,255,255,0.025);
    border-color: var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user__identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 99px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
}

.sidebar-user__copy strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Chat Main ---- */
.chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.chat-main__header {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(5, 5, 7, 0.65);
    backdrop-filter: blur(8px);
}

.chat-main__title strong {
    display: block;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.chat-main__title span {
    display: block;
    font-size: 12px;
    color: var(--fg-subtle);
    margin-top: 1px;
}

/* ---- Messages ---- */
.chat-view {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chat-view--mla .messages {
    background:
        radial-gradient(circle at 18% 0%, rgba(59, 130, 246, 0.07), transparent 30%),
        var(--bg);
}

.chat-view--mla .composer .input-wrap {
    border-color: rgba(59, 130, 246, 0.24);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px 24px;
    scroll-behavior: smooth;
}

.scroll-bottom-button {
    position: absolute;
    left: 50%;
    bottom: 152px;
    z-index: 8;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.045)),
        var(--bg-raised);
    color: var(--fg);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.035) inset;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px) scale(0.88);
    cursor: pointer;
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.18s ease, background 0.18s ease;
}

.scroll-bottom-button.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0) scale(1);
    animation: scrollButtonFloat 1.55s ease-in-out infinite;
}

.scroll-bottom-button:hover {
    border-color: var(--border-hover);
    background:
        linear-gradient(180deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.08)),
        var(--bg-raised);
    transform: translate(-50%, -2px) scale(1.04);
}

.scroll-bottom-button:active {
    transform: translate(-50%, 0) scale(0.96);
}

.scroll-bottom-button svg {
    width: 16px;
    height: 16px;
    display: block;
}

@keyframes scrollButtonFloat {
    0%, 100% {
        transform: translate(-50%, 0) scale(1);
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38), 0 0 0 1px rgba(255, 255, 255, 0.035) inset;
    }
    50% {
        transform: translate(-50%, -5px) scale(1);
        box-shadow: 0 22px 58px rgba(0, 0, 0, 0.44), 0 0 0 1px rgba(59, 130, 246, 0.13) inset;
    }
}

/* ---- Multi Level Agents ---- */
.mla-view {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 32px 24px;
    animation: fadeUp 0.22s ease-out;
}

.mla-hero,
.mla-compose {
    width: min(1120px, 100%);
    margin: 0 auto;
}

.mla-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    position: relative;
    overflow: hidden;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background:
        radial-gradient(circle at 18% 12%, rgba(59, 130, 246, 0.18), transparent 32%),
        radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.11), transparent 30%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mla-hero::after {
    content: "";
    position: absolute;
    inset: auto -80px -120px auto;
    width: 280px;
    height: 280px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.1);
    filter: blur(26px);
    pointer-events: none;
}

.mla-hero__content,
.mla-hero__action {
    position: relative;
    z-index: 1;
}

.mla-kicker {
    display: block;
    margin-bottom: 12px;
    color: var(--fg-subtle);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.mla-hero h1 {
    font-size: clamp(34px, 5vw, 58px);
    line-height: 0.92;
    letter-spacing: -0.065em;
}

.mla-hero p,
.mla-muted {
    margin-top: 14px;
    max-width: 580px;
    color: var(--fg-muted);
    line-height: 1.6;
}

.mla-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.mla-hero__meta span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--fg-soft);
    font-size: 12px;
    font-weight: 800;
}

.mla-hero__action {
    min-width: 150px;
    box-shadow: 0 14px 38px rgba(59, 130, 246, 0.22);
}

.mla-compose {
    margin-top: 14px;
}

.mla-prompt {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
    padding: 14px;
}

.mla-prompt textarea {
    min-height: 104px;
    max-height: 220px;
    resize: vertical;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--fg);
    font: inherit;
    line-height: 1.55;
}

.mla-prompt textarea::placeholder {
    color: var(--fg-subtle);
}

.mla-task-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.mla-status {
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius);
    background: rgba(245, 158, 11, 0.06);
    color: #fbbf24;
    font-size: 12px;
    font-weight: 650;
}

.mla-task-card {
    min-height: 158px;
    text-align: left;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.025);
    color: var(--fg);
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.mla-task-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.04);
}

.mla-task-card.active {
    border-color: rgba(59, 130, 246, 0.42);
    background:
        linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(59, 130, 246, 0.035)),
        rgba(255, 255, 255, 0.025);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}

.mla-task-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    margin-bottom: 18px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent);
}

.mla-task-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.mla-task-card small {
    color: var(--fg-muted);
    font-size: 12px;
    line-height: 1.45;
}

.mla-agent-lab {
    position: relative;
    overflow: hidden;
    margin-top: 12px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 15% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 34%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    animation: fadeUp 0.24s ease-out;
}

.mla-agent-lab::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.5), transparent 72%);
    pointer-events: none;
}

.mla-agent-lab__head,
.mla-function-grid,
.mla-pipeline {
    position: relative;
    z-index: 1;
}

.mla-agent-lab__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.mla-agent-lab__head .mla-kicker {
    margin-bottom: 6px;
}

.mla-agent-lab__head strong {
    display: block;
    font-size: 20px;
    letter-spacing: -0.03em;
}

.mla-agent-lab__head small {
    display: block;
    margin-top: 6px;
    max-width: 620px;
    color: var(--fg-muted);
    line-height: 1.45;
}

.mla-depth {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
}

.mla-depth button {
    min-height: 34px;
    padding: 0 13px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--fg-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 850;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.mla-depth button:hover {
    color: var(--fg);
}

.mla-depth button.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 24%, transparent);
}

.mla-function-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.mla-function-chip,
.mla-function-empty {
    min-height: 112px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(0, 0, 0, 0.16);
}

.mla-function-chip {
    text-align: left;
    color: var(--fg);
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.mla-function-chip:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.04);
}

.mla-function-chip.active {
    border-color: color-mix(in srgb, var(--accent) 55%, transparent);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), rgba(255, 255, 255, 0.025)),
        rgba(255, 255, 255, 0.02);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.mla-function-chip strong {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
}

.mla-function-chip small,
.mla-function-empty {
    color: var(--fg-muted);
    font-size: 12px;
    line-height: 1.45;
}

.mla-function-empty {
    grid-column: 1 / -1;
    display: grid;
    place-items: center;
    min-height: 86px;
}

.mla-pipeline {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.mla-pipeline span {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.075);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--fg-soft);
    font-size: 12px;
    font-weight: 850;
}

.mla-pipeline span:not(:last-child)::after {
    content: "";
    position: absolute;
    right: -9px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: color-mix(in srgb, var(--accent) 45%, transparent);
}

.mla-pipeline em {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 18%, transparent);
    color: var(--accent);
    font-style: normal;
    font-size: 10px;
}

.mla-history {
    margin-top: 18px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.02);
}

.mla-history__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.mla-history__head strong {
    font-size: 14px;
}

.mla-history__head span {
    color: var(--fg-subtle);
    font-size: 12px;
}

.mla-history__list {
    display: grid;
    gap: 8px;
}

.mla-history-item {
    width: 100%;
    display: grid;
    gap: 5px;
    padding: 12px;
    text-align: left;
    color: var(--fg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-raised);
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.mla-history-item:hover,
.mla-history-item.active {
    transform: translateY(-1px);
    border-color: rgba(59, 130, 246, 0.32);
    background: rgba(59, 130, 246, 0.08);
}

.mla-history-item strong {
    font-size: 13px;
}

.mla-history-item span {
    color: var(--fg-subtle);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-view--mla .messages {
    padding: 28px 24px;
}

.chat-view--mla .messages__inner {
    width: min(1180px, 100%);
    max-width: none;
    gap: 0;
}

.mla-run-workspace {
    display: grid;
    gap: 14px;
    animation: fadeUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.mla-run-command {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    position: relative;
    overflow: hidden;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 34%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.mla-run-command::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.48), transparent 72%);
    pointer-events: none;
}

.mla-run-command > * {
    position: relative;
    z-index: 1;
}

.mla-run-kicker {
    display: block;
    margin-bottom: 8px;
    color: var(--fg-subtle);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.mla-run-command h2 {
    font-size: clamp(30px, 4vw, 52px);
    line-height: 0.96;
    letter-spacing: -0.06em;
}

.mla-run-command p {
    max-width: 720px;
    margin-top: 12px;
    color: var(--fg-muted);
    line-height: 1.6;
}

.mla-run-status {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.24);
    color: var(--fg-soft);
    font-size: 12px;
    font-weight: 900;
}

.mla-run-status span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 20px color-mix(in srgb, var(--success) 62%, transparent);
}

.mla-run-status.live span {
    animation: pulseDot 1.15s ease-in-out infinite;
}

.mla-run-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.mla-run-metrics div {
    min-height: 74px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.025);
}

.mla-run-metrics span {
    display: block;
    color: var(--fg-subtle);
    font-size: 11px;
    font-weight: 800;
}

.mla-run-metrics strong {
    display: block;
    margin-top: 8px;
    color: var(--fg);
    font-size: 22px;
    letter-spacing: -0.04em;
}

.mla-run-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.mla-run-mission,
.mla-run-output,
.mla-run-stage {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.025);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.mla-run-mission {
    position: sticky;
    top: 18px;
    padding: 18px;
}

.mla-run-mission strong {
    display: block;
    margin-bottom: 12px;
    font-size: 15px;
}

.mla-run-mission p {
    color: var(--fg-muted);
    line-height: 1.65;
    white-space: pre-wrap;
}

.mla-run-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.mla-run-stage {
    position: relative;
    overflow: hidden;
    min-height: 184px;
    padding: 14px;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.mla-run-stage::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent 58%);
    transition: opacity 0.18s ease;
}

.mla-run-stage.done,
.mla-run-stage.active {
    border-color: color-mix(in srgb, var(--accent) 34%, transparent);
}

.mla-run-stage.active {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

.mla-run-stage.active::before {
    opacity: 1;
    animation: scanWash 1.8s ease-in-out infinite;
}

.mla-run-stage__top,
.mla-run-stage strong,
.mla-run-stage p {
    position: relative;
    z-index: 1;
}

.mla-run-stage__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
}

.mla-run-stage__top span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    font-size: 11px;
    font-weight: 950;
}

.mla-run-stage__top em {
    color: var(--fg-subtle);
    font-style: normal;
    font-size: 11px;
    font-weight: 850;
}

.mla-run-stage.active .mla-run-stage__top em {
    color: var(--accent);
}

.mla-run-stage strong {
    display: block;
    margin-bottom: 9px;
    font-size: 14px;
}

.mla-run-stage p {
    color: var(--fg-muted);
    font-size: 12px;
    line-height: 1.55;
}

.mla-run-output {
    grid-column: 2;
    overflow: hidden;
    min-height: 320px;
}

.mla-run-output__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.18);
}

.mla-run-output__head strong {
    display: block;
    font-size: 16px;
}

.mla-run-output__head > span {
    min-height: 28px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--fg-subtle);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.mla-run-output__content {
    padding: 22px;
}

.mla-run-placeholder {
    min-height: 220px;
    display: grid;
    place-items: center;
    gap: 10px;
    color: var(--fg-muted);
    text-align: center;
}

.mla-run-placeholder strong {
    color: var(--fg);
}

.mla-run-placeholder small {
    color: var(--fg-subtle);
}

@keyframes pulseDot {
    0%, 100% {
        transform: scale(1);
        opacity: 0.72;
    }
    50% {
        transform: scale(1.35);
        opacity: 1;
    }
}

@keyframes scanWash {
    0%, 100% {
        transform: translateX(-14%);
    }
    50% {
        transform: translateX(14%);
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.messages__inner {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.message {
    display: flex;
    gap: 14px;
    max-width: 840px;
    animation: msgIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.message.user {
    margin-left: auto;
    flex-direction: row-reverse;
}

@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--fg);
    color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-body {
    flex: 1;
    min-width: 0;
}

.message-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.message.user .message-meta {
    justify-content: flex-end;
}

.message-meta strong {
    font-size: 13px;
    font-weight: 600;
}

.message-meta span {
    font-size: 11px;
    color: var(--fg-subtle);
}

.message-content {
    color: var(--fg-muted);
    line-height: 1.75;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.markdown-rendered {
    white-space: normal;
}

.markdown-rendered p {
    margin: 0 0 10px;
}

.markdown-rendered h2,
.markdown-rendered h3,
.markdown-rendered h4 {
    margin: 16px 0 8px;
    color: var(--fg);
    font-size: 15px;
    font-weight: 650;
    line-height: 1.35;
}

.markdown-rendered h2:first-child,
.markdown-rendered h3:first-child,
.markdown-rendered h4:first-child {
    margin-top: 0;
}

.markdown-rendered p:last-child,
.markdown-rendered ul:last-child,
.markdown-rendered pre:last-child,
.markdown-rendered .math-block:last-child,
.markdown-rendered .function-plot:last-child {
    margin-bottom: 0;
}

.markdown-rendered strong {
    color: var(--fg);
    font-weight: 650;
}

.markdown-rendered em {
    color: var(--fg);
    font-style: italic;
}

.markdown-rendered ul {
    margin: 0 0 12px;
    padding-left: 19px;
}

.markdown-rendered li {
    margin: 5px 0;
    padding-left: 2px;
}

.markdown-rendered li::marker {
    color: var(--accent);
}

.markdown-rendered code,
.math-inline {
    padding: 2px 5px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--fg);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 12px;
}

.math-inline {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    vertical-align: baseline;
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.08);
    color: var(--fg);
}

.markdown-rendered pre {
    margin: 10px 0 12px;
    padding: 16px 18px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #09090c;
    color: var(--fg);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    line-height: 1.65;
}

.code-block {
    margin: 12px 0 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: #08090d;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

.code-block__toolbar {
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 10px 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
}

.code-block__toolbar span {
    color: var(--fg-subtle);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.code-block__actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.code-block__actions button {
    height: 26px;
    padding: 0 9px;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--fg-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.code-block__actions button:hover {
    transform: translateY(-1px);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.08);
    color: var(--fg);
}

.code-block__actions button[data-code-action="run"] {
    color: #bfdbfe;
    border-color: rgba(96, 165, 250, 0.22);
    background: rgba(59, 130, 246, 0.1);
}

.code-block pre,
.markdown-rendered .code-block pre {
    margin: 0;
    padding: 14px 16px 16px;
    overflow-x: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.code-block code,
.markdown-rendered .code-block code {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    color: #d4d7df;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre;
    tab-size: 4;
}

.tok-comment { color: #6b7280; font-style: italic; }
.tok-string { color: #a7f3d0; }
.tok-keyword { color: #93c5fd; font-weight: 650; }
.tok-number { color: #fbbf24; }
.tok-tag { color: #fca5a5; }
.tok-attr { color: #c4b5fd; }
.tok-meta { color: #60a5fa; }
.tok-punctuation { color: #9ca3af; }

.math-block {
    width: min(640px, 100%);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 8px auto 14px;
    padding: 2px 0;
    overflow: visible;
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--fg);
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 18px;
    line-height: 1.8;
    letter-spacing: 0;
}

.math-equation {
    width: fit-content;
    max-width: 100%;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 4px;
    overflow-x: auto;
}

.math-block--compact {
    width: fit-content;
    align-items: flex-start;
    justify-content: flex-start;
    margin: 6px 0 12px;
    padding: 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 17px;
    line-height: 1.55;
}

.math-block--compact .math-equation {
    min-height: 0;
    justify-content: flex-start;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

.math-block--compact .math-op {
    padding: 0 3px;
}

.math-op {
    color: var(--fg-muted);
    padding: 0 5px;
}

.math-space {
    display: inline-block;
    width: 0.7em;
    flex-shrink: 0;
}

.math-space--wide {
    width: 1.25em;
}

.math-space--xwide {
    width: 2em;
}

.math-text {
    color: var(--fg-muted);
    font-family: var(--font-sans);
    font-size: 0.86em;
    font-style: normal;
    padding: 0 2px;
}

.math-fn {
    color: #bfdbfe;
    font-family: var(--font-sans);
    font-size: 0.9em;
    font-style: normal;
    padding-right: 1px;
}

.math-boxed {
    display: inline-flex;
    align-items: baseline;
    padding: 2px 8px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.035);
}

.math-set,
.math-symbol {
    color: var(--fg);
}

.math-inline sup,
.math-inline sub,
.math-block sup,
.math-block sub {
    color: var(--fg);
    line-height: 0;
    margin-left: 1px;
    position: relative;
}

.math-inline sup,
.math-block sup {
    font-size: 0.62em;
    top: -0.42em;
}

.math-inline sub,
.math-block sub {
    font-size: 0.68em;
    top: 0.25em;
}

.math-frac {
    display: inline-grid;
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: center;
    vertical-align: middle;
    margin: 0 3px;
    line-height: 1.1;
}

.math-frac span:first-child {
    min-width: 100%;
    padding: 0 4px 2px;
    border-bottom: 1px solid currentColor;
}

.math-frac span:last-child {
    padding-top: 2px;
}

.math-root {
    display: inline-flex;
    align-items: flex-start;
    gap: 2px;
}

.math-root span:last-child {
    padding: 0 3px;
    border-top: 1px solid currentColor;
}

.function-plot {
    width: min(780px, 100%);
    min-height: 260px;
    display: grid;
    grid-template-columns: minmax(260px, 0.96fr) minmax(300px, 1.18fr);
    margin: 12px 0 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    overflow: hidden;
    background: #242424;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
    font-family: var(--font-sans);
}

.function-plot__panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    background: #252525;
}

.function-plot__chrome {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 12px;
    margin-bottom: 24px;
}

.function-plot__chrome span {
    width: 7px;
    height: 7px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.46);
}

.function-plot__formula {
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 6px 20px;
    color: #fff;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 22px;
    line-height: 1.35;
    overflow-x: auto;
}

.function-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: auto;
}

.function-control {
    display: grid;
    grid-template-columns: 18px 44px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    color: #fff;
}

.function-control__name {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 15px;
    font-style: italic;
}

.function-control__value {
    color: #fff;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 11px;
    text-align: right;
}

.function-param {
    width: 100%;
    accent-color: #5da8ff;
}

.function-param::-webkit-slider-runnable-track {
    height: 14px;
    border-radius: 999px;
    background: #353535;
}

.function-param::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    margin-top: -1px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    background: #1f1f1f;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.34);
    appearance: none;
}

.function-plot__canvas {
    min-width: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    background: #202020;
}

.function-canvas {
    width: 100%;
    height: 260px;
    display: block;
}

.markdown-rendered pre code {
    padding: 0;
    border: none;
    background: transparent;
    font-size: inherit;
}

.message-bubble {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    border-top-left-radius: 4px;
    padding: 14px 16px;
    color: var(--fg-muted);
    line-height: 1.75;
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-bubble.user-bubble {
    background: var(--bg-surface);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: 4px;
    color: var(--fg);
    border-color: var(--border-hover);
}

body[data-message-style="bubble"] .message-content.markdown-rendered {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    border-top-left-radius: 4px;
    background: var(--bg-raised);
}

body[data-message-style="bubble"] .message-bubble.user-bubble {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 24%, transparent);
}

body[data-message-style="minimal"] .message-icon,
body[data-message-style="minimal"] .message-meta {
    opacity: 0.72;
}

body[data-message-style="minimal"] .message-bubble,
body[data-message-style="minimal"] .message-content.markdown-rendered {
    padding: 0;
    border: 0;
    background: transparent;
}

/* ---- Composer ---- */
.composer {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border);
    background: linear-gradient(to top, var(--bg) 80%, transparent);
}

body[data-composer-style="floating"] .composer {
    border-top: 0;
    background: linear-gradient(to top, var(--bg) 64%, transparent);
    padding-bottom: 30px;
}

body[data-composer-style="floating"] .composer .input-wrap {
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
}

body[data-composer-style="compact"] .composer {
    padding: 10px 20px 14px;
}

body[data-composer-style="compact"] .composer .input-wrap {
    padding: 8px 8px 8px 13px;
    border-radius: var(--radius);
}

body[data-composer-style="compact"] .composer textarea {
    min-height: 28px;
    line-height: 1.45;
}

.composer__inner {
    max-width: 860px;
    margin: 0 auto;
}

.limit-toast {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 120;
    width: min(320px, calc(100vw - 32px));
    padding: 12px 14px;
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-lg);
    background:
        linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(245, 158, 11, 0.045)),
        rgba(18, 18, 21, 0.94);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(16px);
    color: #fbbf24;
    font-size: 12px;
    font-weight: 650;
    line-height: 1.45;
    animation: toastIn 0.22s ease-out;
}

.limit-toast--danger {
    border-color: rgba(239, 68, 68, 0.24);
    background:
        linear-gradient(135deg, rgba(239, 68, 68, 0.13), rgba(239, 68, 68, 0.045)),
        rgba(18, 18, 21, 0.94);
    color: #fca5a5;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.composer .input-wrap {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 10px 10px 16px;
    gap: 0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.composer .input-wrap:focus-within {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.06);
}

.composer.composer--locked .input-wrap {
    position: relative;
    border-color: rgba(148, 163, 184, 0.24);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
        var(--bg-raised);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
    cursor: not-allowed;
}

.composer.composer--locked .input-wrap textarea {
    color: var(--fg-subtle);
    cursor: not-allowed;
}

.composer.composer--locked .input-wrap textarea::placeholder {
    color: var(--fg-muted);
}

.composer.composer--locked .composer__footer {
    opacity: 0.45;
    pointer-events: none;
}

.composer textarea {
    flex: 1 1 100%;
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    font-size: 14px;
    line-height: 1.6;
    padding: 6px 0;
    resize: none;
    min-height: 44px;
    max-height: 200px;
}

.composer textarea::placeholder {
    color: var(--fg-subtle);
}

/* ---- Composer Footer ---- */
.composer__footer {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
    padding: 0 4px;
    min-width: 0;
}

.composer__send {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.045);
    color: var(--fg-muted);
    box-shadow: none;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
}

.composer__send svg {
    width: 16px;
    height: 16px;
    display: block;
    transform: none;
}

.composer__send:hover {
    transform: translateY(-1px);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.075);
    color: var(--fg);
}

.composer__send:active {
    transform: translateY(0) scale(0.96);
    background: rgba(255, 255, 255, 0.095);
}

.composer__send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* Custom Dropdown */
.composer-model {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.composer-model__label {
    color: var(--fg-subtle);
    font-size: 12px;
    user-select: none;
}

.composer-model__trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 99px;
    background: var(--bg);
    color: var(--fg);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.composer-model__trigger:hover {
    border-color: var(--border-hover);
    background: var(--bg-surface);
}

.composer-model__trigger svg {
    width: 12px;
    height: 12px;
    color: var(--fg-subtle);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.composer-model.open .composer-model__trigger svg {
    transform: rotate(180deg);
}

.composer-model__menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 24px;
    min-width: 220px;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    padding: 6px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: dropdownIn 0.15s ease-out;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.composer-model__option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--fg-muted);
    cursor: pointer;
    transition: all 0.12s ease;
}

.composer-model__option:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--fg);
}

.composer-model__option.active {
    background: var(--accent-soft);
    color: var(--fg);
    font-weight: 500;
}

.composer-model__option .check-icon {
    width: 14px;
    height: 14px;
    margin-left: auto;
    opacity: 0;
    color: var(--accent);
}

.composer-model__option.active .check-icon {
    opacity: 1;
}

/* ---- Typing ---- */
.typing-bubble {
    width: fit-content;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.035);
    color: var(--fg-subtle);
}

.typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0;
}

.typing span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--fg-subtle);
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
}

/* ---- Empty ---- */
.empty-state {
    padding: 20px;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--fg-subtle);
    text-align: center;
    font-size: 13px;
}

/* ============================================
   ACCOUNT MODAL
   ============================================ */

.modal-backdrop {
    --backdrop-blur: 10px;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(var(--backdrop-blur));
    z-index: 90;
    animation: backdropIn 0.18s ease-out;
}

.confirm-backdrop {
    --backdrop-blur: 8px;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(var(--backdrop-blur));
    z-index: 110;
    animation: backdropIn 0.18s ease-out;
}

.confirm-modal {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(380px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    padding: 18px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
    z-index: 111;
    transform-origin: center;
    animation: confirmIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.confirm-modal__icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: var(--danger-soft);
    color: #fca5a5;
}

.confirm-modal__body h2 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
}

.confirm-modal__body p {
    color: var(--fg-subtle);
    font-size: 12px;
    line-height: 1.5;
    word-break: break-word;
}

.confirm-modal__actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 4px;
}

.search-backdrop {
    --backdrop-blur: 9px;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(var(--backdrop-blur));
    z-index: 106;
    animation: backdropIn 0.18s ease-out;
}

.chat-search-modal {
    position: fixed;
    inset: 50% auto auto 50%;
    z-index: 107;
    width: min(720px, calc(100vw - 32px));
    max-height: min(680px, calc(100vh - 40px));
    display: flex;
    flex-direction: column;
    transform: translate(-50%, -50%);
    overflow: hidden;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: 0 34px 100px rgba(0, 0, 0, 0.62);
    transform-origin: center;
    animation: modalIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-search-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 18px;
    border-bottom: 1px solid var(--border);
}

.chat-search-modal__head h2 {
    font-size: 16px;
    font-weight: 650;
}

.chat-search-modal__head p {
    margin-top: 4px;
    color: var(--fg-subtle);
    font-size: 12px;
}

.chat-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 18px 12px;
    padding: 0 13px;
    min-height: 46px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg-subtle);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.chat-search-box:focus-within {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.07);
}

.chat-search-box input {
    width: 100%;
    min-width: 0;
    height: 44px;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--fg);
}

.chat-search-box input::placeholder {
    color: var(--fg-subtle);
}

.chat-search-results {
    min-height: 180px;
    overflow-y: auto;
    padding: 0 18px 18px;
}

.chat-search-empty {
    display: grid;
    place-items: center;
    min-height: 160px;
    color: var(--fg-subtle);
    text-align: center;
    font-size: 13px;
}

.chat-search-result {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    margin-bottom: 8px;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.018);
    color: var(--fg);
    cursor: pointer;
    transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
    animation: listItemIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.chat-search-result:nth-child(2) { animation-delay: 0.025s; }
.chat-search-result:nth-child(3) { animation-delay: 0.05s; }
.chat-search-result:nth-child(4) { animation-delay: 0.075s; }
.chat-search-result:nth-child(5) { animation-delay: 0.1s; }

.chat-search-result:hover {
    transform: translateY(-1px);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.035);
}

.chat-search-result__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.chat-search-result__top strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 650;
}

.chat-search-result__top span {
    flex: 0 0 auto;
    color: var(--fg-subtle);
    font-size: 11px;
}

.chat-search-snippet {
    color: var(--fg-muted);
    font-size: 13px;
    line-height: 1.5;
}

.chat-search-snippet mark {
    padding: 1px 3px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.18);
    color: var(--fg);
}

.code-preview-backdrop {
    --backdrop-blur: 10px;
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(var(--backdrop-blur));
    animation: backdropIn 0.18s ease-out;
}

.code-preview-modal {
    position: fixed;
    inset: 50% auto auto 50%;
    z-index: 111;
    width: min(980px, calc(100vw - 36px));
    height: min(720px, calc(100vh - 36px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translate(-50%, -50%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-raised);
    box-shadow: var(--shadow-lg);
    transform-origin: center;
    animation: modalIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.code-preview-modal__head {
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px 12px 18px;
    border-bottom: 1px solid var(--border);
}

.code-preview-modal__head span {
    display: block;
    color: var(--fg-subtle);
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.code-preview-modal__head strong {
    display: block;
    margin-top: 2px;
    color: var(--fg);
    font-size: 15px;
}

.code-preview-frame {
    width: 100%;
    min-height: 0;
    flex: 1;
    border: 0;
    background: #fff;
}

.account-modal {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(1320px, calc(100vw - 48px));
    height: min(740px, calc(100vh - 40px));
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    z-index: 91;
    display: flex;
    flex-direction: column;
    transform-origin: center;
    animation: modalIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes backdropIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(var(--backdrop-blur, 8px));
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 10px)) scale(0.975);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes confirmIn {
    0% {
        opacity: 0;
        transform: translate(-50%, calc(-50% + 8px)) scale(0.94);
    }
    70% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.015);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes listItemIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateX(8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.account-modal__layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    height: 100%;
    min-height: 0;
}

.account-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    background: rgba(255, 255, 255, 0.015);
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.account-nav__profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.account-avatar {
    border-radius: 99px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.account-avatar.has-image,
.sidebar-avatar.has-image {
    color: transparent;
}

.account-avatar--large {
    width: 48px;
    height: 48px;
    font-size: 16px;
}

.account-avatar--hero {
    width: 64px;
    height: 64px;
    font-size: 22px;
}

.account-nav__copy strong,
.account-profile-hero__copy strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-nav__copy span,
.account-profile-hero__copy span {
    display: block;
    font-size: 12px;
    color: var(--fg-subtle);
    margin-top: 2px;
    word-break: break-word;
}

.account-nav__tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-tab {
    width: 100%;
    height: 38px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--fg-muted);
    border-radius: var(--radius);
    text-align: left;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.account-tab:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border);
    color: var(--fg);
}

.account-tab.active {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 35%, transparent);
    color: var(--fg);
}

.account-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.account-modal__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.account-modal__head h2 {
    font-size: 16px;
    font-weight: 600;
}

.account-modal__head p {
    margin-top: 4px;
    color: var(--fg-subtle);
    font-size: 12px;
}

.account-modal__body {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-section:not(.hidden) {
    animation: panelIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.account-section:not(.hidden) .account-card,
.account-section:not(.hidden) .ai-panel {
    animation: cardIn 0.24s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.account-section:not(.hidden) .account-card:nth-child(2) { animation-delay: 0.035s; }
.account-section:not(.hidden) .account-card:nth-child(3) { animation-delay: 0.07s; }

.account-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.account-card:hover {
    transform: translateY(-1px);
    border-color: var(--border-hover);
    background: rgba(255, 255, 255, 0.027);
}

.account-card--danger {
    border-color: rgba(239, 68, 68, 0.12);
}

.account-card__head strong {
    font-size: 13px;
    font-weight: 600;
}

.account-card__head span {
    display: block;
    margin-top: 4px;
    color: var(--fg-subtle);
    font-size: 12px;
}

.account-profile-hero {
    display: flex;
    align-items: center;
    gap: 16px;
}

.account-actions-inline {
    display: flex;
    justify-content: flex-end;
}

.account-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-grid,
.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.account-grid__wide {
    grid-column: 1 / -1;
}

.account-grid .account-actions-inline,
.settings-grid + .account-actions-inline {
    grid-column: 1 / -1;
}

.appearance-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.82fr) minmax(540px, 1.18fr);
    gap: 18px;
    align-items: start;
}

.appearance-controls {
    min-width: 0;
}

.appearance-preview-panel {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.02);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.18);
}

@media (max-width: 1180px) {
    .appearance-layout {
        grid-template-columns: minmax(260px, 0.64fr) minmax(460px, 1.36fr);
    }

    .appearance-layout .settings-grid {
        grid-template-columns: 1fr;
    }
}

.appearance-layout .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.appearance-layout .account-actions-inline {
    justify-content: stretch;
}

.appearance-layout .account-actions-inline .button {
    width: 100%;
}

.account-card textarea {
    width: 100%;
    min-height: 78px;
    background: transparent;
    border: none;
    outline: none;
    resize: vertical;
}

.setting-option {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--fg-muted);
    font-size: 12px;
    font-weight: 600;
}

.setting-option select {
    width: 100%;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #08080b;
    color: var(--fg);
    padding: 0 12px;
    outline: none;
}

.toggle-list,
.limit-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toggle-row,
.limit-row {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.018);
}

.toggle-row span,
.limit-row span {
    color: var(--fg-muted);
    font-size: 13px;
}

.toggle-row input {
    appearance: none;
    position: relative;
    width: 38px;
    height: 22px;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)),
        var(--bg);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.38);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.toggle-row input::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--fg-subtle);
    box-shadow: 0 2px 7px rgba(0, 0, 0, 0.34);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background 0.18s ease;
}

.toggle-row input:hover {
    border-color: var(--border-hover);
}

.toggle-row input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14), inset 0 1px 2px rgba(0, 0, 0, 0.38);
}

.toggle-row input:checked {
    border-color: color-mix(in srgb, var(--accent) 48%, transparent);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 74%, #fff 8%), var(--accent-hover)),
        var(--accent);
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 22%, transparent);
}

.toggle-row input:checked::before {
    transform: translateX(16px);
    background: #fff;
}

.toggle-row input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.appearance-preview {
    --preview-bg: var(--bg);
    --preview-raised: var(--bg-raised);
    --preview-surface: var(--bg-surface);
    --preview-border: var(--border);
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 36%),
        rgba(255, 255, 255, 0.018);
}

.appearance-preview[data-theme="midnight"] {
    --preview-bg: #020617;
    --preview-raised: #07111f;
    --preview-surface: #0f1b2d;
    --preview-border: rgba(148, 163, 184, 0.12);
}

.appearance-preview[data-theme="graphite"] {
    --preview-bg: #101010;
    --preview-raised: #171717;
    --preview-surface: #202020;
    --preview-border: rgba(255, 255, 255, 0.08);
}

.appearance-preview[data-radius="sharp"] {
    --radius-sm: 3px;
    --radius: 5px;
    --radius-lg: 7px;
    --radius-xl: 9px;
}

.appearance-preview[data-radius="round"] {
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
}

.appearance-preview[data-accent="green"] { --accent: #22c55e; --accent-soft: rgba(34, 197, 94, 0.12); }
.appearance-preview[data-accent="amber"] { --accent: #f59e0b; --accent-soft: rgba(245, 158, 11, 0.13); }
.appearance-preview[data-accent="rose"] { --accent: #f43f5e; --accent-soft: rgba(244, 63, 94, 0.12); }

.appearance-preview[data-surface-style="glass"] {
    --preview-raised: rgba(14, 14, 17, 0.74);
    --preview-surface: rgba(24, 24, 28, 0.64);
    --preview-border: rgba(255, 255, 255, 0.1);
}

.appearance-preview[data-surface-style="flat"] {
    --preview-raised: var(--preview-bg);
    --preview-surface: rgba(255, 255, 255, 0.035);
    --preview-border: rgba(255, 255, 255, 0.045);
}

.appearance-preview__shell {
    height: 360px;
    display: flex;
    overflow: hidden;
    border: 1px solid var(--preview-border);
    border-radius: var(--radius-xl);
    background: var(--preview-bg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.appearance-preview[data-sidebar-position="right"] .appearance-preview__shell {
    flex-direction: row-reverse;
}

.appearance-preview__sidebar {
    width: 76px;
    flex: 0 0 auto;
    display: grid;
    align-content: start;
    gap: 8px;
    padding: 14px 10px;
    border-right: 1px solid var(--preview-border);
    background: var(--preview-raised);
}

.appearance-preview[data-sidebar-position="right"] .appearance-preview__sidebar {
    border-right: 0;
    border-left: 1px solid var(--preview-border);
}

.appearance-preview[data-sidebar-width="compact"] .appearance-preview__sidebar { width: 58px; }
.appearance-preview[data-sidebar-width="wide"] .appearance-preview__sidebar { width: 104px; }

.appearance-preview__sidebar span {
    height: 24px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.045);
}

.appearance-preview__sidebar span:first-child {
    background: var(--accent-soft);
    border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
}

.appearance-preview__main {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.appearance-preview__topbar {
    height: 34px;
    border-bottom: 1px solid var(--preview-border);
    background: rgba(255, 255, 255, 0.018);
}

.appearance-preview[data-header-blur="on"] .appearance-preview__topbar {
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.035);
}

.appearance-preview__messages {
    flex: 1;
    display: grid;
    align-content: center;
    gap: 10px;
    padding: 22px;
}

.appearance-preview[data-density="compact"] .appearance-preview__messages { gap: 6px; padding: 14px; }
.appearance-preview[data-density="spacious"] .appearance-preview__messages { gap: 16px; padding: 22px; }

.appearance-preview__bubble {
    max-width: 72%;
    padding: 8px 10px;
    border-radius: var(--radius-lg);
    color: var(--fg-muted);
    font-size: 12px;
    line-height: 1.35;
}

.appearance-preview-panel .appearance-preview {
    padding: 10px;
}

.appearance-preview__bubble--assistant {
    border: 1px solid transparent;
}

.appearance-preview__bubble--user {
    justify-self: end;
    background: var(--preview-surface);
    color: var(--fg);
    border: 1px solid var(--preview-border);
}

.appearance-preview[data-message-style="bubble"] .appearance-preview__bubble--assistant {
    background: var(--preview-raised);
    border-color: var(--preview-border);
}

.appearance-preview[data-message-style="bubble"] .appearance-preview__bubble--user {
    background: var(--accent-soft);
    border-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

.appearance-preview[data-message-style="minimal"] .appearance-preview__bubble {
    padding: 0;
    border: 0;
    background: transparent;
}

.appearance-preview__composer {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 14px 14px;
    padding: 0 10px 0 12px;
    border: 1px solid var(--preview-border);
    border-radius: var(--radius-lg);
    background: var(--preview-raised);
    color: var(--fg-subtle);
    font-size: 11px;
}

.appearance-preview__composer strong {
    width: 22px;
    height: 22px;
    border-radius: var(--radius);
    background: var(--accent);
}

.appearance-preview[data-composer-style="floating"] .appearance-preview__composer {
    margin-inline: 24px;
    margin-bottom: 18px;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.appearance-preview[data-composer-style="compact"] .appearance-preview__composer {
    min-height: 34px;
    margin-bottom: 10px;
    border-radius: var(--radius);
}

.limit-row strong {
    color: var(--fg);
    font-size: 12px;
    font-weight: 650;
}

.ai-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ai-status-card,
.usage-clean,
.ai-simple-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.022);
}

.ai-status-card {
    min-height: 104px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    background:
        radial-gradient(circle at 15% 10%, var(--accent-soft), transparent 42%),
        rgba(255, 255, 255, 0.024);
}

.ai-eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--fg-subtle);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ai-status-card strong {
    display: block;
    color: var(--fg);
    font-size: 24px;
    font-weight: 750;
    letter-spacing: -0.03em;
}

.ai-status-card__badge {
    min-width: 76px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid color-mix(in srgb, var(--accent) 34%, transparent);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--fg);
    font-size: 12px;
    font-weight: 700;
}

.setting-option--clean {
    gap: 10px;
}

.usage-clean {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    overflow: hidden;
}

.usage-meter {
    padding: 16px;
}

.usage-meter + .usage-meter {
    border-left: 1px solid var(--border);
}

.usage-meter__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.usage-meter__top span {
    color: var(--fg-muted);
    font-size: 13px;
    font-weight: 650;
}

.usage-meter__top strong {
    color: var(--fg);
    font-size: 12px;
}

.usage-meter__bar {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}

.usage-meter__bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.35s ease;
}

.ai-simple-row {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 0 16px;
}

.ai-simple-row span {
    color: var(--fg-muted);
    font-size: 13px;
    font-weight: 650;
}

.ai-simple-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .mini-features {
        grid-template-columns: 1fr;
    }
    
    .hero--landing h1 {
        font-size: clamp(30px, 9vw, 44px);
    }
    
    .chat-shell {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        max-height: 45vh;
    }
    
    .chat-main__header {
        padding: 0 16px;
    }
    
    .messages {
        padding: 20px 16px;
    }

    .mla-view {
        padding: 20px 16px;
    }

    .mla-hero {
        align-items: flex-start;
        flex-direction: column;
        padding: 22px;
    }

    .mla-hero__action {
        width: 100%;
    }

    .mla-prompt {
        grid-template-columns: 1fr;
    }

    .mla-task-grid {
        grid-template-columns: 1fr;
    }

    .mla-agent-lab__head {
        flex-direction: column;
    }

    .mla-depth {
        width: 100%;
    }

    .mla-depth button {
        flex: 1;
    }

    .mla-function-grid,
    .mla-pipeline {
        grid-template-columns: 1fr;
    }

    .mla-pipeline span:not(:last-child)::after {
        display: none;
    }

    .function-plot {
        grid-template-columns: 1fr;
    }

    .function-plot__canvas {
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .mla-run-command {
        flex-direction: column;
    }

    .mla-run-status {
        width: 100%;
        justify-content: center;
    }

    .mla-run-metrics,
    .mla-run-grid,
    .mla-run-board {
        grid-template-columns: 1fr;
    }

    .mla-run-mission {
        position: static;
    }

    .mla-run-output {
        grid-column: auto;
    }
    
    .composer {
        padding: 12px 16px 20px;
    }

    .scroll-bottom-button {
        bottom: 138px;
    }

    .account-modal {
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
        border-radius: var(--radius-lg);
    }

    .account-modal__layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .account-nav {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .account-nav__profile {
        flex: 1;
        min-width: 0;
    }

    .account-nav__tabs {
        flex-direction: row;
        gap: 4px;
    }

    .account-tab {
        width: auto;
        padding: 0 14px;
        white-space: nowrap;
    }

    .account-modal__head,
    .account-modal__body {
        padding: 16px;
    }

    .account-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .appearance-layout {
        grid-template-columns: 1fr;
    }

    .appearance-preview-panel {
        position: static;
    }

    .usage-clean {
        grid-template-columns: 1fr;
    }

    .usage-meter + .usage-meter {
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}
