:root {
    color-scheme: dark;
    --bg: #070a12;
    --bg-2: #0a0f1b;
    --bg-3: #0d1322;
    --panel: rgba(15, 22, 39, 0.72);
    --panel-solid: #101729;
    --panel-soft: rgba(255, 255, 255, 0.035);
    --line: rgba(148, 163, 184, 0.14);
    --line-strong: rgba(148, 163, 184, 0.26);
    --text: #e9eefb;
    --muted: #8e9bb2;
    --muted-2: #6c788e;
    --accent: #8b5cf6;
    --accent-2: #22d3ee;
    --accent-3: #f472b6;
    --green: #34d399;
    --red: #fb7185;
    --amber: #fbbf24;
    --grad: linear-gradient(135deg, #8b5cf6 0%, #6d8dff 46%, #22d3ee 100%);
    --grad-soft: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(34, 211, 238, 0.12));
    --radius: 16px;
    --sidebar: 306px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

a {
    color: #7dd3fc;
}

[hidden] {
    display: none !important;
}

.file-input {
    position: fixed;
    top: 0;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
}

::selection {
    background: rgba(139, 92, 246, 0.45);
    color: #fff;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.22);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(circle at 10% -10%, rgba(139, 92, 246, 0.16), transparent 42%),
        radial-gradient(circle at 90% 0%, rgba(34, 211, 238, 0.1), transparent 38%),
        linear-gradient(180deg, #070a12 0%, #080c16 100%);
}

.orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(80px);
    opacity: 0.36;
}

.orb-a {
    width: 420px;
    height: 420px;
    left: -120px;
    top: 8%;
    background: #7c3aed;
    animation: drift 22s ease-in-out infinite alternate;
}

.orb-b {
    width: 360px;
    height: 360px;
    right: -90px;
    top: -80px;
    background: #0891b2;
    animation: drift 26s ease-in-out infinite alternate-reverse;
}

.orb-c {
    width: 300px;
    height: 300px;
    right: 20%;
    bottom: -160px;
    background: #db2777;
    opacity: 0.18;
    animation: drift 30s ease-in-out infinite alternate;
}

.grid-glow {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.045) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(circle at 50% 0%, #000 0%, transparent 72%);
    opacity: 0.5;
}

@keyframes drift {
    from {
        transform: translate3d(0, 0, 0) scale(1);
    }
    to {
        transform: translate3d(30px, 40px, 0) scale(1.08);
    }
}

.app {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 18px 14px 14px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(11, 16, 28, 0.92), rgba(8, 12, 21, 0.86));
    backdrop-filter: blur(22px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 6px 18px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    color: #fff;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 50%),
        var(--grad);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    flex: 0 0 auto;
}

.brand-mark svg {
    width: 29px;
    height: 29px;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.brand-copy strong {
    font-size: 15px;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-copy span {
    font-size: 11.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-close {
    display: none;
    margin-left: auto;
}

.new-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    margin: 0 0 18px;
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(34, 211, 238, 0.08));
    color: #ddd6fe;
    font-weight: 600;
    transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.new-chat:hover {
    border-color: rgba(139, 92, 246, 0.75);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.28), rgba(34, 211, 238, 0.12));
    transform: translateY(-1px);
}

.new-chat .plus {
    font-size: 18px;
    line-height: 1;
    color: #c4b5fd;
}

.side-section {
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.side-section.grow {
    flex: 1;
    margin-bottom: 0;
}

.side-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-2);
    padding: 0 6px;
}

.side-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 6px;
}

.count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--panel-soft);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.kind-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 2px;
}

.kind-tab {
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.16s ease;
}

.kind-tab:hover {
    color: var(--text);
    background: var(--panel-soft);
}

.kind-tab.active {
    color: #f5f3ff;
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.38);
}

.search {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 2px 4px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.025);
    transition: border-color 0.16s ease, background 0.16s ease;
}

.search:focus-within {
    border-color: rgba(34, 211, 238, 0.45);
    background: rgba(34, 211, 238, 0.04);
}

.search svg {
    width: 16px;
    height: 16px;
    color: var(--muted-2);
    flex: 0 0 auto;
}

.search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 12.5px;
}

.search input::placeholder {
    color: var(--muted-2);
}

.model-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 0 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.model-group-label {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 12px 8px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.model-group-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.model-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.model-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(148, 163, 184, 0.16);
}

.model-item.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.17), rgba(34, 211, 238, 0.06));
    border-color: rgba(139, 92, 246, 0.4);
    box-shadow: inset 3px 0 0 #8b5cf6;
}

.model-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.model-kind-badge {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #dbeafe;
    background: rgba(59, 130, 246, 0.18);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.model-kind-badge.kind-image {
    color: #fce7f3;
    background: rgba(236, 72, 153, 0.16);
    border-color: rgba(236, 72, 153, 0.3);
}

.model-kind-badge.kind-video {
    color: #fef3c7;
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.3);
}

.model-kind-badge.kind-speech {
    color: #d1fae5;
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.3);
}

.model-kind-badge.kind-transcription {
    color: #e0e7ff;
    background: rgba(99, 102, 241, 0.16);
    border-color: rgba(99, 102, 241, 0.3);
}

.model-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12.5px;
    font-weight: 600;
    color: #dfe6f4;
}

.model-check {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.8);
    opacity: 0;
    flex: 0 0 auto;
}

.model-item.active .model-check {
    opacity: 1;
}

.model-id {
    padding-left: 30px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding-left: 30px;
}

.tag {
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

.tag.hot {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.12);
    border-color: rgba(139, 92, 246, 0.25);
}

.model-price {
    padding-left: 30px;
    font-family: var(--mono);
    font-size: 9.5px;
    color: #a7f3d0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-skeleton {
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.07) 37%, rgba(255, 255, 255, 0.03) 63%);
    background-size: 400% 100%;
    animation: shimmer 1.4s ease infinite;
}

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

.empty-list {
    padding: 18px 10px;
    text-align: center;
    color: var(--muted-2);
    font-size: 12px;
}

.side-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.router-status {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 6px;
    font-size: 11px;
    color: var(--muted);
}

.router-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--amber);
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.1);
    flex: 0 0 auto;
}

.router-status.online .dot {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1);
}

.router-status.offline .dot {
    background: var(--red);
    box-shadow: 0 0 0 4px rgba(251, 113, 133, 0.1);
}

.ghost-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.16s ease;
}

.ghost-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--line-strong);
}

.ghost-btn svg {
    width: 15px;
    height: 15px;
}

.router-url {
    padding: 0 6px;
    font-family: var(--mono);
    font-size: 9.5px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(3, 6, 12, 0.7);
    backdrop-filter: blur(4px);
}

.main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    position: relative;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 74px;
    padding: 0 26px;
    border-bottom: 1px solid var(--line);
    background: rgba(7, 10, 18, 0.55);
    backdrop-filter: blur(18px);
    flex: 0 0 auto;
}

.menu-btn {
    display: none;
}

.topbar-title {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.eyebrow {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.topbar-title h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.active-model {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 380px;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 11.5px;
    color: var(--muted);
}

.active-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
    flex: 0 0 auto;
}

.active-model-name {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #dbe3f3;
    font-weight: 600;
}

.active-model-kind {
    padding-left: 8px;
    border-left: 1px solid var(--line);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-2);
    white-space: nowrap;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 37px;
    height: 37px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    transition: all 0.16s ease;
    flex: 0 0 auto;
}

.icon-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--line-strong);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.icon-btn.small {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.icon-btn.small svg {
    width: 14px;
    height: 14px;
}

.workspace {
    position: relative;
    flex: 1;
    min-height: 0;
}

.view {
    height: 100%;
    min-height: 0;
}

.chat-view {
    display: flex;
    flex-direction: column;
}

.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 34px clamp(18px, 4vw, 54px) 16px;
    scroll-behavior: smooth;
}

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 820px;
    min-height: 100%;
    margin: 0 auto;
    padding: 16px 0 44px;
    text-align: center;
    animation: rise 0.45s ease both;
}

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

.welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    border: 1px solid rgba(139, 92, 246, 0.32);
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.1);
    color: #c4b5fd;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 8px rgba(52, 211, 153, 0.85);
}

.welcome h2 {
    margin: 20px 0 8px;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.1;
    letter-spacing: -0.045em;
    font-weight: 680;
    background: linear-gradient(135deg, #ffffff 15%, #c4b5fd 55%, #67e8f9 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.welcome > p {
    max-width: 590px;
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 700px;
}

.suggestions button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
    text-align: left;
    transition: all 0.18s ease;
}

.suggestions button:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.42);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(34, 211, 238, 0.05));
}

.suggestion-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 33px;
    height: 33px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.25);
    color: #c4b5fd;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
}

.suggestions button > span:last-child {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.suggestions strong {
    font-size: 12.5px;
    font-weight: 600;
    color: #e2e8f5;
}

.suggestions small {
    color: var(--muted-2);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.capability-strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin-top: 22px;
}

.capability-strip span {
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 880px;
    margin: 0 auto 22px;
    animation: rise 0.28s ease both;
}

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

.message-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 31px;
    height: 31px;
    margin-top: 2px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    font-family: var(--mono);
}

.message.assistant .message-avatar {
    color: #ddd6fe;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(34, 211, 238, 0.14));
    border-color: rgba(139, 92, 246, 0.32);
}

.message-body {
    min-width: 0;
    max-width: min(100%, 760px);
}

.message.user .message-body {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 2px 5px;
    font-size: 10.5px;
    color: var(--muted-2);
}

.message-meta strong {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

.message-bubble {
    padding: 12px 15px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.035);
    font-size: 13.7px;
    line-height: 1.68;
    overflow-wrap: anywhere;
}

.message.assistant .message-bubble {
    border-top-left-radius: 5px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
}

.message.user .message-bubble {
    border-top-right-radius: 5px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.26), rgba(79, 70, 229, 0.18));
    border-color: rgba(139, 92, 246, 0.35);
}

.message-bubble p {
    margin: 0 0 10px;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
    margin: 16px 0 8px;
    line-height: 1.3;
    letter-spacing: -0.015em;
}

.message-bubble h1 {
    font-size: 19px;
}

.message-bubble h2 {
    font-size: 17px;
}

.message-bubble h3 {
    font-size: 15px;
}

.message-bubble h4 {
    font-size: 14px;
}

.message-bubble ul,
.message-bubble ol {
    margin: 8px 0;
    padding-left: 22px;
}

.message-bubble li {
    margin: 3px 0;
}

.message-bubble blockquote {
    margin: 10px 0;
    padding: 7px 12px;
    border-left: 3px solid rgba(139, 92, 246, 0.55);
    background: rgba(139, 92, 246, 0.06);
    border-radius: 0 8px 8px 0;
    color: #cbd5e1;
}

.message-bubble code {
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(2, 6, 23, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.14);
    font-family: var(--mono);
    font-size: 0.88em;
    color: #a5f3fc;
}

.code-block {
    position: relative;
    margin: 12px 0;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 11px;
    background: #050914;
    overflow: hidden;
}

.code-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 11px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255, 255, 255, 0.025);
    font-family: var(--mono);
    font-size: 10px;
    color: var(--muted-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.code-block pre {
    margin: 0;
    padding: 12px 13px;
    overflow-x: auto;
}

.code-block pre code {
    padding: 0;
    border: 0;
    background: transparent;
    color: #d6e2f5;
    font-size: 12.2px;
    line-height: 1.6;
}

.copy-code {
    padding: 2px 7px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    font-family: var(--font);
    font-size: 9.5px;
    text-transform: none;
    letter-spacing: 0;
}

.copy-code:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.message-bubble a {
    color: #7dd3fc;
    text-decoration: none;
    border-bottom: 1px solid rgba(125, 211, 252, 0.35);
}

.message-bubble a:hover {
    border-bottom-color: #7dd3fc;
}

.message-bubble img {
    max-width: 100%;
    border-radius: 9px;
    margin: 8px 0;
}

.message-attachment {
    max-width: 280px;
    margin-bottom: 9px;
    border-radius: 11px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.message-attachment img {
    display: block;
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: 0;
    margin: 0;
}

.reasoning {
    margin-bottom: 9px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 9px;
    background: rgba(2, 6, 23, 0.3);
    overflow: hidden;
}

.reasoning summary {
    padding: 7px 11px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    cursor: pointer;
    list-style: none;
}

.reasoning summary::-webkit-details-marker {
    display: none;
}

.reasoning-body {
    padding: 0 11px 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
}

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

.typing span {
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: #a78bfa;
    animation: blink 1.2s infinite ease-in-out;
}

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

.typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes blink {
    0%,
    80%,
    100% {
        opacity: 0.25;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-action {
    padding: 3px 7px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: transparent;
    color: var(--muted-2);
    font-size: 10px;
}

.message-action:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.message-error {
    margin-top: 6px;
    padding: 9px 12px;
    border: 1px solid rgba(251, 113, 133, 0.28);
    border-radius: 9px;
    background: rgba(251, 113, 133, 0.07);
    color: #fda4af;
    font-size: 12px;
}

.composer-wrap {
    position: relative;
    flex: 0 0 auto;
    padding: 8px clamp(16px, 4vw, 54px) 16px;
    background: linear-gradient(180deg, rgba(7, 10, 18, 0), rgba(7, 10, 18, 0.88) 32%, rgba(7, 10, 18, 0.98));
}

.composer-wrap > * {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.attachment-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 8px;
    border: 1px solid rgba(34, 211, 238, 0.24);
    border-radius: 12px;
    background: rgba(34, 211, 238, 0.05);
}

.attachment-preview {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1;
}

.attachment-preview img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.attachment-preview div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.attachment-preview strong {
    font-size: 11.5px;
    color: #cffafe;
}

.attachment-preview span {
    font-size: 10.5px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 9px 8px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 17px;
    background: rgba(13, 19, 34, 0.88);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.composer:focus-within {
    border-color: rgba(139, 92, 246, 0.55);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38), 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.attach-btn {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    flex: 0 0 auto;
    transition: all 0.15s ease;
}

.attach-btn:hover {
    color: #c4b5fd;
    background: rgba(139, 92, 246, 0.12);
}

.attach-btn svg {
    width: 19px;
    height: 19px;
}

.composer textarea {
    flex: 1;
    min-height: 36px;
    max-height: 210px;
    padding: 7px 2px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 13.5px;
    line-height: 1.55;
    resize: none;
}

.composer textarea::placeholder {
    color: var(--muted-2);
}

.send-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 13px;
    border: 0;
    border-radius: 10px;
    background: var(--grad);
    color: #fff;
    font-size: 12px;
    font-weight: 650;
    box-shadow: 0 6px 18px rgba(109, 141, 255, 0.28);
    flex: 0 0 auto;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(109, 141, 255, 0.38);
    filter: brightness(1.06);
}

.send-btn:disabled {
    transform: none;
    filter: grayscale(0.4);
}

.send-btn svg {
    width: 15px;
    height: 15px;
}

.stop-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(251, 113, 133, 0.36);
    border-radius: 10px;
    background: rgba(251, 113, 133, 0.1);
    color: #fecdd3;
    font-size: 12px;
    font-weight: 600;
    flex: 0 0 auto;
}

.stop-square {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: currentColor;
}

.composer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 7px 0;
    font-size: 10.5px;
    color: var(--muted-2);
}

.composer-foot > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.foot-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.foot-actions button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--muted-2);
    font-size: 10.5px;
}

.foot-actions button:hover {
    color: var(--muted);
}

.tool-view {
    overflow: hidden;
}

.tool-layout {
    display: grid;
    grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
    height: 100%;
    min-height: 0;
}

.tool-panel {
    min-height: 0;
    overflow-y: auto;
    padding: 28px 26px 34px;
    border-right: 1px solid var(--line);
    background: rgba(9, 13, 24, 0.42);
}

.tool-head {
    margin-bottom: 20px;
}

.tool-kicker {
    display: inline-block;
    margin-bottom: 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #67e8f9;
}

.tool-head h2,
.dialog-head h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.03em;
}

.tool-head p {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.6;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field > span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11.5px;
    font-weight: 600;
    color: #cbd5e1;
}

.field > span b {
    font-weight: 600;
    color: #a5b4fc;
    font-family: var(--mono);
    font-size: 10.5px;
}

.field small {
    color: var(--muted-2);
    font-size: 10.5px;
    line-height: 1.45;
}

.field textarea,
.field input[type="number"],
.field input[type="text"],
.field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: 0;
    background: rgba(255, 255, 255, 0.028);
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.55;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.field textarea {
    resize: vertical;
    min-height: 96px;
}

.field textarea:focus,
.field input:focus,
.field select:focus {
    border-color: rgba(139, 92, 246, 0.5);
    background: rgba(139, 92, 246, 0.035);
}

.field input[type="range"] {
    width: 100%;
    accent-color: #8b5cf6;
}

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

.params-grid .field.wide {
    grid-column: 1 / -1;
}

.field.checkbox-field {
    justify-content: flex-end;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 39px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.028);
    font-size: 12px;
    color: #cbd5e1;
}

.checkbox-row input {
    accent-color: #8b5cf6;
}

.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    border: 0;
    border-radius: 11px;
    background: var(--grad);
    color: #fff;
    font-size: 13px;
    font-weight: 650;
    box-shadow: 0 8px 24px rgba(109, 141, 255, 0.24);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 11px 30px rgba(109, 141, 255, 0.34);
    filter: brightness(1.05);
}

.primary-btn:disabled {
    transform: none;
    filter: grayscale(0.5);
}

.primary-btn svg {
    width: 16px;
    height: 16px;
}

.primary-btn.compact {
    width: auto;
    padding: 9px 16px;
    font-size: 12px;
}

.tool-output {
    min-height: 0;
    overflow-y: auto;
    padding: 28px clamp(20px, 3vw, 38px) 38px;
}

.output-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 17px;
}

.output-head h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.output-status {
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted-2);
    font-size: 10px;
    white-space: nowrap;
}

.output-status.busy {
    color: #fde68a;
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.08);
}

.output-status.success {
    color: #a7f3d0;
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(52, 211, 153, 0.08);
}

.output-status.error {
    color: #fecdd3;
    border-color: rgba(251, 113, 133, 0.3);
    background: rgba(251, 113, 133, 0.08);
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    border: 1px dashed var(--line-strong);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.012);
}

.empty-state > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    max-width: 300px;
    padding: 30px;
    text-align: center;
}

.empty-art {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    max-width: 300px;
    padding: 30px;
    text-align: center;
}

.empty-art svg {
    width: 54px;
    height: 54px;
    margin-bottom: 10px;
    color: #4b5b78;
}

.empty-art strong,
.empty-state strong {
    color: #a8b3c7;
    font-size: 12.5px;
    font-weight: 600;
}

.empty-art span,
.empty-state span {
    color: var(--muted-2);
    font-size: 11.5px;
    line-height: 1.5;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.media-grid.empty-state {
    display: flex;
}

.media-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
}

.media-card img,
.media-card video {
    display: block;
    width: 100%;
    border-radius: 9px;
    background: #050914;
    object-fit: cover;
}

.media-card img {
    aspect-ratio: 1 / 1;
}

.media-card video {
    aspect-ratio: 16 / 9;
}

.media-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.media-card-foot span {
    font-family: var(--mono);
    font-size: 9.5px;
    color: var(--muted-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-download {
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    text-decoration: none;
    flex: 0 0 auto;
}

.media-download:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.job-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.job-list.empty-state {
    display: flex;
}

.job-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.job-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.job-title {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.job-title strong {
    font-size: 12.5px;
    color: #dbe3f3;
}

.job-title span {
    font-family: var(--mono);
    font-size: 9.5px;
    color: var(--muted-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.job-state {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fde68a;
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.job-state.success {
    color: #a7f3d0;
    background: rgba(52, 211, 153, 0.1);
    border-color: rgba(52, 211, 153, 0.3);
}

.job-state.error {
    color: #fecdd3;
    background: rgba(251, 113, 133, 0.1);
    border-color: rgba(251, 113, 133, 0.3);
}

.job-track {
    height: 5px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    overflow: hidden;
}

.job-track span {
    display: block;
    height: 100%;
    width: 36%;
    border-radius: inherit;
    background: var(--grad);
    transition: width 0.4s ease;
}

.job-track.indeterminate span {
    animation: jobmove 1.4s ease-in-out infinite;
}

@keyframes jobmove {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(320%);
    }
}

.job-prompt {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.job-error {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(251, 113, 133, 0.07);
    border: 1px solid rgba(251, 113, 133, 0.24);
    color: #fda4af;
    font-size: 11.5px;
}

.audio-result {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 300px;
}

.audio-result:not(.empty-state) {
    justify-content: flex-start;
}

.audio-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
}

.audio-card audio {
    width: 100%;
    margin-bottom: 10px;
}

.audio-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    color: var(--muted);
}

.transcript-result {
    min-height: 300px;
}

.transcript-result:not(.empty-state) {
    display: block;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
}

.transcript-text {
    margin: 0 0 14px;
    color: #dbe3f3;
    font-size: 13.5px;
    line-height: 1.75;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.transcript-actions {
    display: flex;
    gap: 8px;
}

.small-btn {
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
}

.small-btn:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 26px 18px;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.018);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.16s ease, background 0.16s ease;
}

.dropzone:hover,
.dropzone.dragging {
    border-color: rgba(139, 92, 246, 0.55);
    background: rgba(139, 92, 246, 0.05);
}

.dropzone input {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    cursor: pointer;
}

.dropzone svg {
    width: 30px;
    height: 30px;
    color: #8b9bb6;
    margin-bottom: 3px;
}

.dropzone strong {
    color: #dbe3f3;
    font-size: 12px;
    font-weight: 600;
}

.dropzone span {
    color: var(--muted-2);
    font-size: 10.5px;
}

.settings-dialog {
    width: min(560px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: transparent;
    color: var(--text);
}

.settings-dialog::backdrop {
    background: rgba(2, 5, 11, 0.7);
    backdrop-filter: blur(8px);
}

.dialog-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 22px;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: linear-gradient(180deg, #121a2d, #0c1220);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

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

.switch-field {
    justify-content: flex-start;
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.028);
    font-size: 11.5px;
    color: var(--muted);
}

.switch-row input {
    accent-color: #8b5cf6;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding-top: 4px;
}

.dialog-actions .ghost-btn {
    padding: 9px 16px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 80;
    max-width: min(460px, calc(100vw - 32px));
    padding: 10px 15px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 11px;
    background: rgba(17, 24, 42, 0.96);
    color: #dbe3f3;
    font-size: 12.5px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, 16px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.24s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.error {
    border-color: rgba(251, 113, 133, 0.4);
    color: #fecdd3;
}

.noscript {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #070a12;
    color: #e9eefb;
    text-align: center;
}

@media (max-width: 1180px) {
    :root {
        --sidebar: 282px;
    }

    .tool-layout {
        grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    }

    .tool-panel {
        padding: 24px 20px 30px;
    }

    .active-model {
        max-width: 300px;
    }

    .active-model-name {
        max-width: 160px;
    }
}

@media (max-width: 960px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 50;
        width: min(320px, 86vw);
        transform: translateX(-104%);
        transition: transform 0.24s ease;
        box-shadow: 24px 0 80px rgba(0, 0, 0, 0.5);
    }

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

    .app.sidebar-open .scrim {
        display: block;
    }

    .sidebar-close,
    .menu-btn {
        display: grid;
    }

    .topbar {
        padding: 0 16px;
    }

    .tool-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
        overflow-y: auto;
    }

    .tool-panel {
        border-right: 0;
        border-bottom: 1px solid var(--line);
        overflow: visible;
    }

    .tool-output {
        overflow: visible;
    }

    .tool-view {
        overflow-y: auto;
    }

    .active-model {
        max-width: 230px;
    }

    .active-model-name {
        max-width: 130px;
    }
}

@media (max-width: 680px) {
    .topbar {
        height: 66px;
        gap: 10px;
    }

    .topbar-title h1 {
        font-size: 15px;
    }

    .eyebrow {
        font-size: 9px;
    }

    .active-model {
        padding: 6px 9px;
        max-width: 170px;
    }

    .active-model-name {
        max-width: 95px;
        font-size: 10.5px;
    }

    .active-model-kind {
        display: none;
    }

    .topbar-actions {
        gap: 6px;
    }

    .messages {
        padding: 20px 14px 10px;
    }

    .welcome {
        padding-bottom: 30px;
    }

    .welcome h2 {
        font-size: 30px;
    }

    .welcome > p {
        font-size: 13px;
        margin-bottom: 20px;
    }

    .suggestions {
        grid-template-columns: 1fr;
    }

    .suggestions button {
        padding: 11px 12px;
    }

    .capability-strip {
        margin-top: 16px;
    }

    .message {
        gap: 9px;
        margin-bottom: 18px;
    }

    .message-avatar {
        width: 27px;
        height: 27px;
        font-size: 9px;
    }

    .message-bubble {
        padding: 10px 12px;
        font-size: 13px;
    }

    .composer-wrap {
        padding: 6px 12px 12px;
    }

    .send-label {
        display: none;
    }

    .send-btn {
        padding: 0 11px;
    }

    .composer-foot {
        padding-left: 4px;
        padding-right: 4px;
    }

    .foot-actions {
        gap: 8px;
    }

    .tool-panel {
        padding: 20px 16px 24px;
    }

    .tool-output {
        padding: 20px 16px 32px;
    }

    .params-grid,
    .dialog-grid {
        grid-template-columns: 1fr;
    }

    .dialog-card {
        padding: 18px;
    }

    .media-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .message-actions {
        opacity: 1;
    }
}

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

/* Account, auth, and admin panels */
.account-card {
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.025);
}

.account-head {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.account-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.18);
    color: #ddd6fe;
    font-size: 13px;
    font-weight: 700;
    flex: 0 0 auto;
}

.account-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.account-copy strong,
.account-copy span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-copy strong {
    font-size: 11.5px;
    color: var(--text);
}

.account-copy span {
    font-size: 10px;
    color: var(--muted-2);
}

.account-balance {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 10.5px;
    color: var(--muted);
}

.account-balance strong {
    color: #c4b5fd;
    font-size: 12px;
    font-weight: 650;
}

.account-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
}

.account-actions a,
.account-actions button {
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.account-actions a:hover,
.account-actions button:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.account-actions form {
    margin: 0 0 0 auto;
}

.balance-warning {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 9px 18px;
    border-bottom: 1px solid rgba(251, 191, 36, 0.2);
    background: rgba(251, 191, 36, 0.08);
    color: #fde68a;
    font-size: 11.5px;
    text-align: center;
}

.balance-warning a {
    color: #fcd34d;
    font-weight: 650;
}

.alert {
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 0 0 14px;
    font-size: 12px;
    line-height: 1.5;
}

.alert-success {
    border-color: rgba(34, 211, 238, 0.28);
    background: rgba(34, 211, 238, 0.07);
    color: #a5f3fc;
}

.alert-error {
    border-color: rgba(251, 113, 133, 0.32);
    background: rgba(251, 113, 133, 0.08);
    color: #fecdd3;
}

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.auth-shell {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
}

.auth-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 26px;
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(18, 26, 45, 0.96), rgba(10, 16, 29, 0.96));
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.auth-brand > div:last-child {
    display: flex;
    flex-direction: column;
}

.auth-brand strong {
    font-size: 15px;
}

.auth-brand span {
    color: var(--muted);
    font-size: 11px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.auth-submit {
    margin-top: 4px;
}

.auth-switch {
    color: var(--muted);
    font-size: 11.5px;
    text-align: center;
}

.auth-switch a {
    color: #a5b4fc;
    font-weight: 600;
    text-decoration: none;
}

.auth-note {
    margin: -6px 0 0;
    color: var(--muted-2);
    font-size: 10.5px;
    line-height: 1.5;
    text-align: center;
}

.panel-page {
    min-height: 100vh;
    min-height: 100dvh;
}

.panel-topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 14px clamp(16px, 3vw, 34px);
    border-bottom: 1px solid var(--line);
    background: rgba(8, 12, 22, 0.88);
    backdrop-filter: blur(18px);
}

.panel-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}

.panel-brand .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
}

.panel-brand .brand-mark svg {
    width: 25px;
    height: 25px;
}

.panel-brand > span:last-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.panel-brand strong {
    font-size: 12.5px;
    white-space: nowrap;
}

.panel-brand small {
    color: var(--muted-2);
    font-size: 9.5px;
}

.panel-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.panel-nav a {
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
    font-size: 11px;
    text-decoration: none;
}

.panel-nav a:hover,
.panel-nav a.active {
    color: var(--text);
    background: var(--panel-soft);
    border-color: var(--line);
}

.panel-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 14px;
    border-left: 1px solid var(--line);
    font-size: 10.5px;
}

.panel-user-name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.panel-balance {
    padding: 5px 8px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 7px;
    background: rgba(139, 92, 246, 0.1);
    color: #ddd6fe;
    font-weight: 650;
    white-space: nowrap;
}

.panel-user form {
    margin: 0;
}

.panel-main {
    position: relative;
    z-index: 1;
    width: min(1320px, 100%);
    margin: 0 auto;
    padding: 28px clamp(16px, 3vw, 34px) 54px;
}

.panel-heading {
    margin-bottom: 18px;
}

.panel-heading h1 {
    margin: 4px 0 6px;
    font-size: clamp(22px, 3vw, 30px);
    letter-spacing: -0.03em;
}

.panel-heading p {
    margin: 0;
    max-width: 720px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 11px;
    margin-bottom: 16px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.025);
}

.stat-card span {
    color: var(--muted-2);
    font-size: 10px;
}

.stat-card strong {
    font-size: 21px;
    letter-spacing: -0.03em;
    color: #f1f5ff;
}

.panel-card {
    padding: 17px;
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.022);
}

.panel-card h2 {
    margin: 0;
    font-size: 14px;
    letter-spacing: -0.01em;
}

.panel-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.panel-card-head p {
    margin: 4px 0 0;
}

.panel-card .count {
    display: inline-grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 10px;
    background: rgba(255, 255, 255, 0.03);
}

.topup-grid {
    display: grid;
    grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.25fr);
    gap: 16px;
    align-items: start;
}

.balance-card {
    background:
        radial-gradient(circle at 0% 0%, rgba(139, 92, 246, 0.14), transparent 60%),
        rgba(255, 255, 255, 0.022);
}

.balance-card > span {
    color: var(--muted-2);
    font-size: 10px;
}

.balance-card > strong {
    display: block;
    margin: 6px 0 8px;
    font-size: clamp(25px, 4vw, 38px);
    letter-spacing: -0.04em;
    color: #ede9fe;
}

.balance-card p {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.balance-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 10.5px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.panel-card .field input,
.panel-card .field select,
.panel-card .field textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: 0;
    background: rgba(255, 255, 255, 0.028);
    color: var(--text);
    font-size: 12px;
    font-family: inherit;
}

.panel-card .field input:focus,
.panel-card .field select:focus,
.panel-card .field textarea:focus {
    border-color: rgba(139, 92, 246, 0.55);
}

.panel-card .field textarea {
    resize: vertical;
}

.panel-card .primary-btn {
    width: auto;
    align-self: flex-start;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
    font-size: 11px;
}

.data-table th,
.data-table td {
    padding: 10px 9px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted-2);
    font-size: 9.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.data-table td strong {
    color: #e7ecf8;
    font-weight: 600;
}

.data-table td small {
    color: var(--muted-2);
    font-size: 9.5px;
}

.data-table input[type="number"],
.data-table input[type="text"] {
    width: 100%;
    min-width: 92px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 10.5px;
    font-family: inherit;
}

.model-table input[type="number"] {
    max-width: 150px;
}

.row-disabled {
    opacity: 0.55;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 9px;
    font-weight: 650;
    white-space: nowrap;
}

.status-pending {
    border-color: rgba(251, 191, 36, 0.3);
    background: rgba(251, 191, 36, 0.09);
    color: #fde68a;
}

.status-approved {
    border-color: rgba(34, 211, 238, 0.3);
    background: rgba(34, 211, 238, 0.08);
    color: #a5f3fc;
}

.status-rejected {
    border-color: rgba(251, 113, 133, 0.3);
    background: rgba(251, 113, 133, 0.08);
    color: #fecdd3;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 0;
}

.compact-form {
    min-width: 190px;
}

.compact-form > input[type="text"],
.compact-form > input[type="number"] {
    flex: 1 1 88px;
}

.inline-actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.tiny-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 9.5px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}

.tiny-btn:hover {
    color: var(--text);
    border-color: var(--line-strong);
}

.tiny-btn.success {
    border-color: rgba(34, 211, 238, 0.28);
    color: #a5f3fc;
}

.tiny-btn.danger {
    border-color: rgba(251, 113, 133, 0.28);
    color: #fecdd3;
}

.check-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 10.5px;
    white-space: nowrap;
}

.check-row input {
    accent-color: #8b5cf6;
}

.panel-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.muted-text {
    color: var(--muted-2);
    font-size: 11px;
    line-height: 1.6;
}

.text-positive {
    color: #a5f3fc;
}

.text-negative {
    color: #fecdd3;
}

@media (max-width: 980px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .topup-grid {
        grid-template-columns: 1fr;
    }

    .panel-user {
        width: 100%;
        padding: 10px 0 0;
        border-left: 0;
        border-top: 1px solid var(--line);
    }

    .panel-nav {
        margin-left: 0;
    }
}

@media (max-width: 680px) {
    .auth-card {
        padding: 20px;
    }

    .panel-topbar {
        gap: 10px;
    }

    .panel-brand strong {
        font-size: 11.5px;
    }

    .panel-main {
        padding-top: 20px;
    }

    .form-row,
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .panel-card {
        padding: 14px;
    }

    .data-table {
        min-width: 590px;
    }
}
