@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/vendor/inter.woff2") format("woff2");
}

:root {
    --bg: #080818;
    --bg-side: #0b0b1f;
    --surface: rgba(20, 20, 46, 0.78);
    --surface-solid: #13132c;
    --surface-2: rgba(255, 255, 255, 0.045);
    --surface-hover: rgba(255, 255, 255, 0.075);
    --border: rgba(150, 152, 255, 0.16);
    --border-strong: rgba(150, 152, 255, 0.3);
    --text: #f5f5ff;
    --text-soft: #d5d6ee;
    --muted: #9a9dc0;
    --accent: #8b5cf6;
    --accent-2: #6366f1;
    --accent-soft: rgba(139, 92, 246, 0.18);
    --grad: linear-gradient(135deg, #a855f7 0%, #7c5cf6 45%, #4f7df9 100%);
    --grad-text: linear-gradient(90deg, #c084fc 0%, #8b7bf7 55%, #60a5fa 100%);
    --danger: #f87171;
    --success: #34d399;
    --warning: #fbbf24;
    --code-bg: #0d0d20;
    --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
    --blob-1: rgba(91, 46, 190, 0.55);
    --blob-2: rgba(40, 38, 130, 0.5);
    --user-bubble: linear-gradient(135deg, rgba(124, 92, 246, 0.32), rgba(79, 125, 249, 0.22));
    --radius: 16px;
    --sidebar-w: 292px;
    color-scheme: dark;
}

[data-theme="light"] {
    --bg: #f4f3ff;
    --bg-side: #ffffff;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-solid: #ffffff;
    --surface-2: rgba(79, 70, 229, 0.05);
    --surface-hover: rgba(79, 70, 229, 0.1);
    --border: rgba(99, 102, 241, 0.2);
    --border-strong: rgba(99, 102, 241, 0.38);
    --text: #15153a;
    --text-soft: #2c2d55;
    --muted: #666a92;
    --accent-soft: rgba(124, 92, 246, 0.14);
    --code-bg: #f6f6fd;
    --shadow: 0 24px 60px -24px rgba(60, 50, 150, 0.35);
    --blob-1: rgba(167, 139, 250, 0.4);
    --blob-2: rgba(147, 197, 253, 0.4);
    --user-bubble: linear-gradient(135deg, rgba(124, 92, 246, 0.16), rgba(79, 125, 249, 0.12));
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

button,
input,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: 0;
    background: none;
    padding: 0;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

a {
    color: #a78bfa;
}

[data-theme="light"] a {
    color: #6d3ff0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

svg {
    flex-shrink: 0;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(140, 142, 200, 0.28);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(140, 142, 200, 0.5);
    background-clip: padding-box;
    border: 2px solid transparent;
}

.hidden {
    display: none !important;
}

.grad-text {
    background: var(--grad-text);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- buttons & fields ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    font-weight: 550;
    font-size: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--grad);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 8px 24px -10px rgba(124, 92, 246, 0.9);
}

.btn-primary:hover:not(:disabled) {
    background: var(--grad);
    filter: brightness(1.1);
    border-color: transparent;
}

.btn-danger {
    color: var(--danger);
    border-color: rgba(248, 113, 113, 0.35);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.6);
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 13px;
    border-radius: 10px;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    color: var(--muted);
    transition: background 0.15s, color 0.15s;
}

.icon-btn:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--text);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field label,
.label {
    font-size: 13px;
    font-weight: 550;
    color: var(--text-soft);
}

.input,
.textarea {
    width: 100%;
    padding: 10px 13px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus,
.textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.textarea {
    resize: vertical;
    min-height: 96px;
    line-height: 1.5;
}

.hint {
    font-size: 12.5px;
    color: var(--muted);
}

.error-text {
    color: var(--danger);
    font-size: 13.5px;
    min-height: 20px;
}

/* ---------- auth screen ---------- */

.auth {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow: auto;
}

.backdrop {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.backdrop i {
    position: absolute;
    border-radius: 46% 54% 60% 40% / 55% 45% 55% 45%;
    filter: blur(2px);
}

.backdrop i:nth-child(1) {
    width: 62%;
    height: 78%;
    left: -14%;
    top: -42%;
    background: linear-gradient(140deg, var(--blob-1), transparent 72%);
    transform: rotate(-14deg);
}

.backdrop i:nth-child(2) {
    width: 46%;
    height: 82%;
    right: -16%;
    top: -22%;
    background: linear-gradient(210deg, var(--blob-2), transparent 70%);
    transform: rotate(18deg);
}

.backdrop i:nth-child(3) {
    width: 70%;
    height: 50%;
    left: 20%;
    bottom: -38%;
    background: radial-gradient(closest-side, var(--blob-2), transparent);
    filter: blur(40px);
}

.auth-card {
    position: relative;
    z-index: 1;
    width: min(420px, 100%);
    padding: 34px 32px 28px;
    border-radius: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 22px;
}

.auth-brand h1 {
    margin: 12px 0 2px;
    font-size: 26px;
    letter-spacing: -0.02em;
}

.auth-brand p {
    margin: 0;
    color: var(--muted);
}

.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 13px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    margin-bottom: 18px;
}

.tabs button {
    flex: 1;
    height: 34px;
    border-radius: 9px;
    font-weight: 550;
    font-size: 14px;
    color: var(--muted);
}

.tabs button.active {
    background: var(--accent-soft);
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* ---------- layout ---------- */

.shell {
    display: flex;
    height: 100dvh;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-side);
    border-right: 1px solid var(--border);
    padding: 22px 16px 14px;
    z-index: 30;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 8px 20px;
}

.brand-title {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.brand-sub {
    font-size: 12.5px;
    color: var(--muted);
}

.new-chat {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 50px;
    padding: 0 16px;
    border-radius: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(100deg, #6d3ff0 0%, #4b3bc4 55%, rgba(52, 50, 130, 0.85) 100%);
    box-shadow: 0 10px 28px -14px rgba(124, 92, 246, 0.95), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    transition: filter 0.15s, transform 0.1s;
}

.new-chat:hover {
    filter: brightness(1.12);
}

.new-chat:active {
    transform: translateY(1px);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 14px;
}

.nav button {
    display: flex;
    align-items: center;
    gap: 13px;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    color: var(--text-soft);
    font-weight: 500;
    text-align: left;
    transition: background 0.15s, color 0.15s;
}

.nav button svg {
    color: var(--muted);
}

.nav button:hover,
.nav button.active {
    background: var(--surface-hover);
    color: var(--text);
}

.nav button.active svg {
    color: #a78bfa;
}

.recent-head {
    margin: 18px 14px 6px;
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.recent {
    flex: 1;
    min-height: 40px;
    overflow-y: auto;
    margin: 0 -6px;
    padding: 0 6px;
}

.chat-row {
    position: relative;
    display: flex;
    align-items: center;
    height: 38px;
    border-radius: 10px;
    color: var(--text-soft);
}

.chat-row:hover,
.chat-row.active {
    background: var(--surface-hover);
    color: var(--text);
}

.chat-row.active {
    box-shadow: inset 2px 0 0 #8b5cf6;
}

.chat-row .open {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 6px 0 12px;
    text-align: left;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-row .more {
    width: 28px;
    height: 28px;
    margin-right: 5px;
    opacity: 0;
}

.chat-row:hover .more,
.chat-row .more:focus-visible,
.chat-row.menu-open .more {
    opacity: 1;
}

.chat-row .dot {
    width: 7px;
    height: 7px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

.empty-note {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--muted);
}

.usage-card {
    margin-top: 12px;
    padding: 13px 14px;
    border-radius: 14px;
    background: linear-gradient(160deg, rgba(124, 92, 246, 0.16), rgba(79, 125, 249, 0.06));
    border: 1px solid var(--border);
    font-size: 13px;
}

.usage-card .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.usage-card .bar {
    height: 6px;
    margin: 9px 0 7px;
    border-radius: 6px;
    background: var(--surface-hover);
    overflow: hidden;
}

.usage-card .bar span {
    display: block;
    height: 100%;
    border-radius: 6px;
    background: var(--grad);
}

.usage-card .sub {
    color: var(--muted);
    font-size: 12px;
}

.user-menu {
    position: relative;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 7px 8px;
    border-radius: 12px;
    text-align: left;
}

.user-btn:hover {
    background: var(--surface-hover);
}

.avatar {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6d3ff0, #4f7df9);
    color: #fff;
    font-weight: 650;
    font-size: 16px;
    flex-shrink: 0;
}

.user-btn .name {
    flex: 1;
    min-width: 0;
    font-weight: 550;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-btn .role {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

/* ---------- main ---------- */

.main {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 68px;
    padding: 0 26px;
    flex-shrink: 0;
}

.topbar .title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 15.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-toggle {
    display: none;
}

.theme-toggle {
    display: flex;
    padding: 4px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(12px);
}

.theme-toggle button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 34px;
    border-radius: 10px;
    color: var(--muted);
}

.theme-toggle button.active {
    background: var(--surface-hover);
    color: var(--text);
}

.banner {
    position: relative;
    z-index: 4;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 26px 6px;
    padding: 11px 14px;
    border-radius: 13px;
    border: 1px solid rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.09);
    font-size: 14px;
}

.banner svg {
    color: var(--warning);
}

.banner span {
    flex: 1;
}

.scroll {
    position: relative;
    z-index: 2;
    flex: 1;
    overflow-y: auto;
    scroll-behavior: auto;
}

.column {
    width: min(840px, 100%);
    margin: 0 auto;
    padding: 0 26px;
}

/* ---------- welcome ---------- */

.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2vh 0 30px;
}

.welcome h1 {
    margin: 22px 0 6px;
    font-size: clamp(36px, 5.2vw, 62px);
    font-weight: 750;
    letter-spacing: -0.03em;
    line-height: 1.08;
}

.welcome .tagline {
    margin: 0;
    font-size: clamp(17px, 2vw, 25px);
    color: var(--text-soft);
}

.swoosh {
    margin: 4px 0 30px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    width: 100%;
}

.suggestion {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 17px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(14px);
    text-align: left;
    font-size: 16px;
    font-weight: 500;
    line-height: 1.35;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.suggestion:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    background: var(--surface-solid);
}

.suggestion span {
    flex: 1;
}

.suggestion .go {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-hover);
    color: var(--text-soft);
}

/* ---------- messages ---------- */

.messages {
    padding: 8px 0 28px;
    display: flex;
    flex-direction: column;
    gap: 26px;
}

.msg {
    display: flex;
    gap: 14px;
    min-width: 0;
}

.msg.user {
    justify-content: flex-end;
}

.msg .who {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.msg .body {
    min-width: 0;
    flex: 1;
}

.msg.user .body {
    flex: 0 1 auto;
    max-width: 82%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.bubble {
    padding: 11px 16px;
    border-radius: 18px 18px 5px 18px;
    background: var(--user-bubble);
    border: 1px solid var(--border);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.attach-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
}

.msg.user .attach-grid {
    justify-content: flex-end;
}

.thumb {
    display: block;
    border-radius: 13px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-2);
    cursor: zoom-in;
}

.thumb img {
    display: block;
    width: 132px;
    height: 132px;
    object-fit: cover;
}

.gen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
    margin: 10px 0 4px;
}

.gen-grid .thumb img {
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    max-height: 460px;
    object-fit: contain;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: 260px;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 13.5px;
    color: inherit;
    text-decoration: none;
}

.file-chip .fname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-chip small {
    color: var(--muted);
    flex-shrink: 0;
}

.status-line {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 14px;
    padding: 5px 0;
}

.dots {
    display: inline-flex;
    gap: 4px;
}

.dots i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: bounce 1.2s ease-in-out infinite;
}

.dots i:nth-child(2) {
    animation-delay: 0.15s;
}

.dots i:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes bounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

@keyframes pulse {
    50% {
        opacity: 0.3;
    }
}

.thinking {
    margin: 0 0 10px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface-2);
    font-size: 13.5px;
}

.thinking summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--muted);
    font-weight: 550;
    list-style: none;
}

.thinking summary::-webkit-details-marker {
    display: none;
}

.thinking .thought {
    padding: 0 14px 12px;
    color: var(--muted);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 320px;
    overflow-y: auto;
}

.msg-error {
    display: flex;
    gap: 10px;
    margin-top: 6px;
    padding: 11px 14px;
    border-radius: 13px;
    border: 1px solid rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.09);
    color: var(--text-soft);
    font-size: 14px;
}

.msg-error svg {
    color: var(--danger);
    margin-top: 2px;
}

.msg-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12.5px;
}

.msg-actions .icon-btn {
    width: 30px;
    height: 30px;
}

.msg-actions .model-tag {
    margin-left: 8px;
}

/* ---------- markdown ---------- */

.md {
    overflow-wrap: anywhere;
}

.md > :first-child {
    margin-top: 0;
}

.md > :last-child {
    margin-bottom: 0;
}

.md p,
.md ul,
.md ol,
.md blockquote,
.md table,
.md .codeblock {
    margin: 0 0 13px;
}

.md h1,
.md h2,
.md h3,
.md h4 {
    margin: 22px 0 10px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.md h1 {
    font-size: 1.5em;
}

.md h2 {
    font-size: 1.28em;
}

.md h3 {
    font-size: 1.12em;
}

.md ul,
.md ol {
    padding-left: 24px;
}

.md li {
    margin: 4px 0;
}

.md blockquote {
    padding: 2px 14px;
    border-left: 3px solid var(--accent);
    color: var(--text-soft);
}

.md hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 18px 0;
}

.md img {
    max-width: 100%;
    border-radius: 12px;
}

.md code {
    font-family: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
}

.md :not(pre) > code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--surface-hover);
}

.md .table-wrap {
    overflow-x: auto;
    margin: 0 0 13px;
}

.md table {
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
}

.md th,
.md td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
}

.md th {
    background: var(--surface-2);
    font-weight: 600;
}

.codeblock {
    border: 1px solid var(--border);
    border-radius: 13px;
    overflow: hidden;
    background: var(--code-bg);
}

.codeblock .bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 14px;
    font-size: 12.5px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.codeblock .copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 8px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 12.5px;
}

.codeblock .copy:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.codeblock pre {
    margin: 0;
    padding: 14px;
    overflow-x: auto;
    font-size: 13.5px;
    line-height: 1.55;
}

.codeblock pre code.hljs {
    padding: 0;
    background: transparent;
}

/* ---------- composer ---------- */

.composer-wrap {
    position: relative;
    z-index: 6;
    flex-shrink: 0;
    padding: 0 0 18px;
}

.composer {
    position: relative;
    border-radius: 24px;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
    padding: 14px 14px 12px 18px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.composer:focus-within {
    border-color: rgba(139, 92, 246, 0.7);
    box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft);
}

.composer textarea {
    display: block;
    width: 100%;
    min-height: 30px;
    max-height: 220px;
    padding: 6px 4px;
    border: 0;
    outline: none;
    resize: none;
    background: transparent;
    font-size: 16.5px;
    line-height: 1.5;
}

.composer textarea::placeholder {
    color: var(--muted);
}

.pending {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    padding: 0 0 10px 2px;
}

.pending-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 9px;
    height: 58px;
    border-radius: 13px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    overflow: hidden;
}

.pending-item.is-file {
    padding: 0 34px 0 12px;
    max-width: 240px;
    font-size: 13.5px;
}

.pending-item img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    display: block;
}

.pending-item .fname {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pending-item small {
    display: block;
    color: var(--muted);
}

.pending-item .remove {
    position: absolute;
    top: 4px;
    right: 4px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(10, 10, 30, 0.78);
    color: #fff;
}

.pending-item.loading img,
.pending-item.loading .meta {
    opacity: 0.45;
}

.pending-item .spin {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.composer-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.composer-row .spacer {
    flex: 1;
}

.pill {
    position: relative;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    height: 42px;
    max-width: 250px;
    padding: 0 13px;
    border-radius: 21px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-weight: 550;
    font-size: 14.5px;
    transition: background 0.15s, border-color 0.15s;
}

.pill-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.pill-btn .txt {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pill-btn .chev {
    color: var(--muted);
}

.attach-btn {
    width: 42px;
    padding: 0;
    justify-content: center;
}

.send-btn {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #fff;
    background: var(--grad);
    box-shadow: 0 10px 26px -10px rgba(124, 92, 246, 0.95);
    transition: filter 0.15s, transform 0.1s, opacity 0.15s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    filter: brightness(1.12);
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn.stop {
    background: var(--surface-hover);
    border: 1px solid var(--border-strong);
    color: var(--text);
    box-shadow: none;
}

.composer-note {
    margin-top: 8px;
    text-align: center;
    font-size: 12px;
    color: var(--muted);
}

/* ---------- menus ---------- */

.menu {
    position: absolute;
    z-index: 60;
    min-width: 190px;
    padding: 6px;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    background: var(--surface-solid);
    box-shadow: var(--shadow);
}

.menu.up {
    bottom: calc(100% + 8px);
}

.menu.left {
    left: 0;
}

.menu.right {
    right: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 9px;
    text-align: left;
    font-size: 14px;
    color: var(--text-soft);
}

.menu-item:hover,
.menu-item.selected {
    background: var(--surface-hover);
    color: var(--text);
}

.menu-item.selected {
    background: var(--accent-soft);
}

.menu-item.danger {
    color: var(--danger);
}

.menu-item .grow {
    flex: 1;
    min-width: 0;
}

.menu-item .sub {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.menu-sep {
    height: 1px;
    margin: 5px 4px;
    background: var(--border);
}

.model-menu {
    width: 330px;
    max-width: calc(100vw - 40px);
    padding: 8px;
}

.model-menu .search {
    margin-bottom: 6px;
    height: 36px;
    padding: 0 11px;
    font-size: 14px;
}

.model-list {
    max-height: min(52vh, 420px);
    overflow-y: auto;
}

.model-group {
    padding: 9px 10px 4px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding: 0 7px;
    border-radius: 6px;
    background: var(--surface-hover);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

.effort-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---------- list views ---------- */

.listview {
    padding: 6px 0 40px;
}

.listview h2 {
    margin: 4px 0 16px;
    font-size: 26px;
    letter-spacing: -0.02em;
}

.search-box {
    position: relative;
    margin-bottom: 16px;
}

.search-box svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.search-box .input {
    height: 46px;
    padding-left: 42px;
    border-radius: 14px;
    background: var(--surface);
}

.list-group {
    margin: 20px 4px 8px;
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.list-item {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(12px);
}

.list-item:hover {
    border-color: var(--border-strong);
}

.list-item .open {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    text-align: left;
}

.list-item .t {
    display: block;
    font-weight: 550;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.list-item .d {
    font-size: 12.5px;
    color: var(--muted);
}

.star-on {
    color: #fbbf24 !important;
}

/* ---------- modal ---------- */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(4, 4, 16, 0.66);
    backdrop-filter: blur(5px);
    animation: fade 0.15s ease-out;
}

@keyframes fade {
    from {
        opacity: 0;
    }
}

.modal {
    width: min(720px, 100%);
    max-height: min(86vh, 760px);
    display: flex;
    flex-direction: column;
    border-radius: 22px;
    border: 1px solid var(--border-strong);
    background: var(--surface-solid);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal.small {
    width: min(440px, 100%);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-head h2 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 20px 24px 24px;
    overflow-y: auto;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px 18px;
    border-top: 1px solid var(--border);
}

.settings {
    display: flex;
    min-height: 0;
    flex: 1;
}

.settings-nav {
    width: 178px;
    flex-shrink: 0;
    padding: 14px 10px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-nav button {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-soft);
}

.settings-nav button:hover,
.settings-nav button.active {
    background: var(--surface-hover);
    color: var(--text);
}

.settings-pane {
    flex: 1;
    min-width: 0;
    padding: 20px 24px 24px;
    overflow-y: auto;
}

.settings-pane h3 {
    margin: 0 0 4px;
    font-size: 16px;
}

.settings-pane .desc {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 13.5px;
}

.section {
    padding: 16px 0;
    border-top: 1px solid var(--border);
}

.section:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 26px;
    padding: 0 11px;
    border-radius: 13px;
    font-size: 12.5px;
    font-weight: 600;
    background: var(--surface-hover);
}

.status-pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
}

.status-pill.ok::before {
    background: var(--success);
}

.status-pill.bad::before {
    background: var(--danger);
}

.device-code {
    margin: 14px 0;
    padding: 18px;
    border-radius: 16px;
    border: 1px dashed var(--border-strong);
    background: var(--accent-soft);
    text-align: center;
}

.device-code .code {
    margin: 8px 0 12px;
    font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.steps {
    margin: 0;
    padding-left: 20px;
    color: var(--text-soft);
    font-size: 14px;
}

.steps li {
    margin: 5px 0;
}

.user-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.user-table th,
.user-table td {
    padding: 9px 8px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.user-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.user-table td:last-child {
    text-align: right;
    white-space: nowrap;
}

.switch {
    position: relative;
    width: 44px;
    height: 26px;
    border-radius: 13px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    transition: background 0.15s;
    flex-shrink: 0;
}

.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s;
}

.switch[aria-checked="true"] {
    background: var(--accent);
    border-color: transparent;
}

.switch[aria-checked="true"]::after {
    transform: translateX(18px);
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.help-card {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface-2);
}

.help-card h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    font-size: 14.5px;
}

.help-card h4 svg {
    color: #a78bfa;
}

.help-card p {
    margin: 0;
    font-size: 13.5px;
    color: var(--muted);
}

kbd {
    padding: 1px 6px;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    font: inherit;
    font-size: 12px;
}

/* ---------- lightbox, drop zone, toasts ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: 56px 24px 24px;
    background: rgba(3, 3, 12, 0.9);
    animation: fade 0.15s ease-out;
}

.lightbox img {
    max-width: 100%;
    max-height: calc(100dvh - 90px);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.lightbox .tools {
    position: absolute;
    top: 14px;
    right: 16px;
    display: flex;
    gap: 8px;
}

.lightbox .tools a,
.lightbox .tools button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.dropzone {
    position: absolute;
    inset: 10px;
    z-index: 50;
    display: grid;
    place-items: center;
    border-radius: 22px;
    border: 2px dashed var(--accent);
    background: rgba(20, 16, 60, 0.82);
    color: #fff;
    font-size: 19px;
    font-weight: 600;
    pointer-events: none;
}

.toasts {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 200;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    max-width: min(520px, 92vw);
    padding: 11px 16px;
    border-radius: 13px;
    border: 1px solid var(--border-strong);
    background: var(--surface-solid);
    box-shadow: var(--shadow);
    font-size: 14px;
    animation: rise 0.2s ease-out;
}

.toast.error {
    border-color: rgba(248, 113, 113, 0.55);
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
}

.scrim {
    display: none;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(var(--sidebar-w), 86vw);
        transform: translateX(-102%);
        transition: transform 0.22s ease;
        box-shadow: var(--shadow);
    }

    .shell.nav-open .sidebar {
        transform: none;
    }

    .shell.nav-open .scrim {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(4, 4, 16, 0.6);
    }

    .menu-toggle {
        display: inline-grid;
    }

    .topbar {
        padding: 0 14px;
        height: 58px;
    }

    .column {
        padding: 0 14px;
    }

    .banner {
        margin: 0 14px 6px;
    }

    .suggestions {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .suggestion {
        padding: 13px 14px;
        font-size: 15px;
    }

    .composer-wrap {
        padding-bottom: 10px;
    }

    .composer {
        border-radius: 20px;
        padding: 10px 10px 10px 13px;
    }

    .pill-btn {
        max-width: 150px;
        height: 38px;
        padding: 0 10px;
    }

    .send-btn {
        width: 42px;
        height: 42px;
    }

    .msg.user .body {
        max-width: 92%;
    }

    .settings {
        flex-direction: column;
    }

    .settings-nav {
        width: auto;
        flex-direction: row;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 8px 10px;
    }

    .settings-nav button {
        flex-shrink: 0;
    }

    .help-grid {
        grid-template-columns: 1fr;
    }

    .composer-note {
        display: none;
    }
}
