/* ===========================
   RESET & VARIABLES
=========================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #080b14;
    --surface: #0d1120;
    --surface2: #131929;
    --surface3: #1a2238;
    --border: rgba(255, 255, 255, .07);
    --border2: rgba(255, 255, 255, .12);
    --accent: #e8ff47;
    --accent-dim: rgba(232, 255, 71, .12);
    --accent-glow: rgba(232, 255, 71, .25);
    --blue: #4d7cff;
    --purple: #9a5cff;
    --grad: linear-gradient(135deg, #4d7cff, #9a5cff);
    --text: #dde2f0;
    --text2: #8892b0;
    --green: #22d87a;
    --red: #ff5b5b;
    --sidebar-w: 290px;
    --radius: 18px;
    /* Drawer heights */
    --drawer-peek: 72px;
    /* how much peeks above bottom when collapsed */
    --drawer-handle-h: 36px;
}

html,
body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Instrument Sans', sans-serif;
    font-size: 15px;
    line-height: 1.65;
    overflow: hidden;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--surface3);
    border-radius: 2px;
}

/* ===========================
   LAYOUT
=========================== */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ===========================
   SIDEBAR
=========================== */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
    z-index: 200;
    overflow: hidden;
}

.sidebar-inner {
    flex: 1;
    padding: 26px 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden;
    min-height: 0;
}

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

.brand-mark {
    position: relative;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background-color: #fff;
}

.brand-mark img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    position: relative;
    z-index: 1;

}

.brand-mark span {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 22px;
    color: #080b14;
    position: relative;
    z-index: 1;
}

.brand-glow {
    position: absolute;
    inset: -4px;
    border-radius: 18px;
    background: var(--accent-glow);
    filter: blur(10px);
    z-index: 0;
}

.brand-mark.sm {
    width: 32px;
    height: 32px;
    border-radius: 9px;
}

.brand-mark.sm span {
    font-size: 15px;
}

.brand-text h2 {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 17px;
    color: #fff;
    letter-spacing: -.2px;
}

.brand-text p {
    font-size: 12px;
    color: var(--text2);
    margin-top: 2px;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: var(--accent);
    border: none;
    border-radius: 12px;
    color: #080b14;
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
}

.new-chat-btn:hover {
    opacity: .9;
    transform: translateY(-1px);
}

.new-chat-btn:active {
    transform: none;
}

.nav-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: var(--text2);
    padding: 0 2px;
}

.quick-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--text2);
    font-size: 13.5px;
    font-family: 'Instrument Sans', sans-serif;
    cursor: pointer;
    text-align: left;
    transition: background .2s, border-color .2s, color .2s;
}

.nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    transition: background .2s;
}

.nav-item:hover {
    background: var(--surface2);
    border-color: var(--border2);
    color: var(--text);
}

.nav-item:hover .nav-icon {
    background: var(--accent-dim);
    color: var(--accent);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: var(--surface2);
    border: 1px solid transparent;
    border-radius: 9px;
    transition: border-color .2s, background .2s;
}

.history-item:hover {
    border-color: var(--border2);
    background: var(--surface3);
}

.history-item.active {
    border-color: rgba(232, 255, 71, .25);
    background: rgba(232, 255, 71, .05);
}

.history-item.active .hist-label {
    color: var(--accent);
}

.hist-label {
    flex: 1;
    font-size: 12.5px;
    color: var(--text2);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color .15s;
}

.history-item:hover .hist-label {
    color: var(--text);
}

.hist-actions {
    display: none;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.history-item:hover .hist-actions {
    display: flex;
}

.hist-btn {
    width: 22px;
    height: 22px;
    background: none;
    border: none;
    border-radius: 5px;
    color: var(--text2);
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .15s, background .15s;
}

.hist-btn:hover {
    color: var(--text);
    background: var(--surface);
}

.hist-btn.del:hover {
    color: #ff5b5b;
}

.history-empty {
    font-size: 12px;
    color: var(--text2);
    padding: 10px 2px;
    line-height: 1.6;
    text-align: center;
}

.nav-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.hist-action-btn {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 11px;
    padding: 4px;
    border-radius: 5px;
    transition: color .15s;
}

.hist-action-btn:hover {
    color: #ff5b5b;
}

.sidebar-foot {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-actions-section {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.quick-actions-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text2);
    font-size: 12px;
    font-family: 'Instrument Sans', sans-serif;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    transition: color .2s, background .2s;
}

.quick-actions-toggle:hover {
    background: var(--surface2);
    color: var(--text);
}

.quick-actions-label {
    flex: 1;
    text-align: left;
}

.toggle-icon {
    font-size: 11px;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}

.quick-actions-section.expanded .toggle-icon {
    transform: rotate(180deg);
}

#quickNavContainer {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height .3s cubic-bezier(.4, 0, .2, 1), opacity .3s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#quickNavContainer.show {
    max-height: 500px;
    opacity: 1;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text2);
    font-size: 13px;
    text-decoration: none;
    transition: color .2s;
    padding: 4px 0;
}

.back-link:hover {
    color: var(--text);
}

/* ===========================
   MAIN
=========================== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    min-width: 0;
    background: var(--bg);
    position: relative;
    /* needed for drawer absolute positioning */
}

/* Scrollable top section — hero + cards */
.main-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* leave space at bottom so hero content isn't hidden behind drawer peek */
    padding-bottom: calc(var(--drawer-peek) + var(--drawer-handle-h) + 20px);
    transition: opacity .3s ease;
}

.main-scroll.collapsed {
    opacity: 0;
    pointer-events: none;
}

/* Topbar (mobile) */
.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 15px;
}

.topbar-btn {
    width: 38px;
    height: 38px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text2);
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s;
}

.topbar-btn:hover {
    color: var(--text);
}

/* ===========================
   HERO
=========================== */
.hero {
    position: relative;
    padding: 56px 48px 44px;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.hero-bg-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 0%, black 40%, transparent 100%);
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -60px;
    right: -60px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(77, 124, 255, .12), transparent 70%);
    pointer-events: none;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 100px;
    background: var(--accent-dim);
    border: 1px solid rgba(232, 255, 71, .2);
    color: var(--accent);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .3px;
    margin-bottom: 22px;
    position: relative;
    animation: fadeSlide .6s ease both;
}

.pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 2s infinite;
}

.hero-heading {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: clamp(32px, 4vw, 56px);
    line-height: 1.08;
    letter-spacing: -1.5px;
    color: #fff;
    margin-bottom: 16px;
    max-width: 700px;
    position: relative;
    animation: fadeSlide .6s .1s ease both;
}

.hero-heading em {
    font-style: normal;
    color: var(--accent);
}

.hero-sub {
    font-size: 16px;
    color: var(--text2);
    max-width: 560px;
    line-height: 1.7;
    margin-bottom: 32px;
    animation: fadeSlide .6s .2s ease both;
}

.stats-strip {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 14px;
    padding: 18px 28px;
    width: fit-content;
    animation: fadeSlide .6s .3s ease both;
}

.stat {
    text-align: center;
    padding: 0 28px;
}

.stat strong {
    display: block;
    font-family: 'Syne', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -1px;
}

.stat span {
    font-size: 12px;
    color: var(--text2);
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border2);
}

/* ===========================
   SUGGESTION CARDS
=========================== */
.suggestion-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 28px 48px;
    border-bottom: 1px solid var(--border);
}

.scard {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: border-color .2s, background .2s, transform .18s;
    animation: fadeSlide .5s ease both;
}

.scard:nth-child(1) {
    animation-delay: .1s
}

.scard:nth-child(2) {
    animation-delay: .15s
}

.scard:nth-child(3) {
    animation-delay: .2s
}

.scard:nth-child(4) {
    animation-delay: .25s
}

.scard:hover {
    border-color: rgba(232, 255, 71, .3);
    background: var(--surface2);
    transform: translateY(-2px);
}

.scard-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: var(--accent-dim);
    border: 1px solid rgba(232, 255, 71, .15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--accent);
    flex-shrink: 0;
}

.scard strong {
    display: block;
    font-size: 14px;
    margin-bottom: 3px;
}

.scard p {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.4;
}

.scard-arrow {
    margin-left: auto;
    color: var(--text2);
    font-size: 12px;
    transition: transform .2s;
    flex-shrink: 0;
}

.scard:hover .scard-arrow {
    transform: translateX(3px);
    color: var(--accent);
}

/* ===========================
   CHAT SHELL — BOTTOM DRAWER
=========================== */
.chat-shell {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    /* collapsed: show only handle + peek */
    height: calc(var(--drawer-peek) + var(--drawer-handle-h));
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: height .4s cubic-bezier(.32, .72, 0, 1);
    z-index: 50;
    /* subtle shadow to lift drawer above hero */
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .45);
}

.chat-shell.expanded {
    height: calc(100% - 0px);
    /* full height of .main */
}

/* ── Drag handle ── */
.drawer-handle {
    height: var(--drawer-handle-h);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: grab;
    flex-shrink: 0;
    padding: 8px 0 4px;
    user-select: none;
    -webkit-user-select: none;
}

.drawer-handle:active {
    cursor: grabbing;
}

.handle-bar {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border2);
    transition: background .2s, width .2s;
}

.drawer-handle:hover .handle-bar {
    background: rgba(232, 255, 71, .45);
    width: 52px;
}

.handle-label {
    font-size: 10.5px;
    color: var(--text2);
    letter-spacing: .8px;
    text-transform: uppercase;
    transition: color .2s, opacity .2s;
    line-height: 1;
}

.chat-shell.expanded .handle-label {
    opacity: 0;
    pointer-events: none;
}

/* Chat topbar */
.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 22px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--text2);
    flex-shrink: 0;
}

/* In-chat search */
.chat-search-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 22px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
}

.chat-search-bar.open {
    display: flex;
}

.chat-search-bar i {
    color: var(--text2);
    font-size: 13px;
}

.chat-search-bar input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: 'Instrument Sans', sans-serif;
    font-size: 14px;
}

.chat-search-bar input::placeholder {
    color: var(--text2);
}

.chat-search-bar button {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 14px;
}

.chat-search-bar button:hover {
    color: var(--text);
}

/* Messages */
.messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    scroll-behavior: smooth;
}

/* Message rows */
.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    animation: fadeUp .3s ease forwards;
    opacity: 0;
}

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

.msg-av {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.msg-row.bot .msg-av {
    background: var(--grad);
    color: #fff;
    font-family: 'Syne', sans-serif;
}

.msg-row.user .msg-av {
    background: var(--surface3);
    border: 1px solid var(--border2);
    color: var(--text2);
}

.msg-body-wrap {
    max-width: 72%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.msg-row.user .msg-body-wrap {
    align-items: flex-end;
}

.msg-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14.5px;
    line-height: 1.65;
    word-break: break-word;
}

.msg-row.bot .msg-bubble {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text);
}

.msg-row.user .msg-bubble {
    background: var(--grad);
    border-bottom-right-radius: 4px;
    color: #fff;
}

.msg-bubble h1,
.msg-bubble h2,
.msg-bubble h3 {
    font-family: 'Syne', sans-serif;
    margin: 10px 0 6px;
    color: #fff;
}

.msg-bubble h1 {
    font-size: 18px;
}

.msg-bubble h2 {
    font-size: 16px;
}

.msg-bubble h3 {
    font-size: 14px;
}

.msg-bubble p {
    margin-bottom: 8px;
}

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

.msg-bubble ul,
.msg-bubble ol {
    padding-left: 20px;
    margin: 6px 0;
}

.msg-bubble li {
    margin: 4px 0;
}

.msg-bubble code {
    background: rgba(255, 255, 255, .08);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.msg-bubble pre {
    background: rgba(0, 0, 0, .3);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    overflow-x: auto;
    margin: 8px 0;
}

.msg-bubble pre code {
    background: none;
    padding: 0;
}

.msg-bubble strong {
    color: #fff;
}

.msg-bubble a {
    color: var(--accent);
}

.msg-bubble blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
    color: var(--text2);
    margin: 6px 0;
}

.msg-bubble table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 13px;
}

.msg-bubble th,
.msg-bubble td {
    border: 1px solid var(--border2);
    padding: 8px 12px;
    text-align: left;
}

.msg-bubble th {
    background: var(--surface3);
    color: var(--accent);
}

.msg-meta {
    font-size: 11px;
    color: var(--text2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text2);
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color .2s;
}

.copy-btn:hover {
    color: var(--accent);
}

/* Typing */
.typing-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.typing-bubble {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    padding: 14px 18px;
}

.typing-dots {
    display: flex;
    gap: 5px;
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text2);
    animation: tdot 1.4s infinite;
}

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

.typing-dots span:nth-child(3) {
    animation-delay: .4s
}

.chat-divider {
    text-align: center;
    font-size: 11px;
    color: var(--text2);
    position: relative;
    margin: 2px 0;
}

.chat-divider::before,
.chat-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 34%;
    height: 1px;
    background: var(--border);
}

.chat-divider::before {
    right: calc(50% + 50px);
}

.chat-divider::after {
    left: calc(50% + 50px);
}

mark {
    background: rgba(232, 255, 71, .3);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* Recommendations bar */
.reco-bar {
    padding: 10px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    background: var(--surface2);
}

.reco-label {
    font-size: 11.5px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .8px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.reco-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.reco-chip {
    padding: 6px 12px;
    background: var(--surface3);
    border: 1px solid var(--border2);
    border-radius: 100px;
    font-size: 12.5px;
    color: var(--text);
    cursor: pointer;
    transition: border-color .2s, background .2s;
    white-space: nowrap;
}

.reco-chip:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
    color: var(--accent);
}

/* Chat actions */
.chat-actions {
    display: flex;
    gap: 8px;
}

.chat-act-btn {
    width: 34px;
    height: 34px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text2);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s, border-color .2s;
}

.chat-act-btn:hover {
    color: var(--text);
    border-color: var(--border2);
}

/* ===========================
   COMPOSER
=========================== */
.composer {
    padding: 16px 18px 12px;
    border-top: 1px solid var(--border);
}

.composer-inner {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 16px;
    padding: 8px 8px 8px 16px;
    transition: border-color .2s, box-shadow .2s;
}

.composer-inner:focus-within {
    border-color: rgba(232, 255, 71, .35);
    box-shadow: 0 0 0 3px rgba(232, 255, 71, .07);
}

.composer-attach {
    background: none;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
    flex-shrink: 0;
    align-self: center;
    transition: color .2s;
}

.composer-attach:hover {
    color: var(--accent);
}

textarea#userInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    resize: none;
    font-family: 'Instrument Sans', sans-serif;
    font-size: 14.5px;
    line-height: 1.6;
    max-height: 140px;
    overflow-y: auto;
    padding: 4px 0;
}

textarea#userInput::placeholder {
    color: var(--text2);
}

.send-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background: var(--accent);
    border: none;
    border-radius: 11px;
    color: #080b14;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .2s, transform .15s;
}

.send-btn:hover {
    opacity: .9;
    transform: scale(1.04);
}

.send-btn:active {
    transform: scale(.97);
}

.send-btn:disabled {
    opacity: .3;
    cursor: default;
    transform: none;
}

.composer-hint {
    font-size: 11px;
    color: var(--text2);
    margin-top: 8px;
    padding-left: 4px;
}

kbd {
    background: var(--surface3);
    border: 1px solid var(--border2);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 10px;
}

/* ===========================
   CONTEXT MENU
=========================== */
.ctx-menu {
    position: fixed;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 12px;
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 500;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
    min-width: 210px;
}

.ctx-menu.open {
    display: flex;
}

.ctx-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text);
    font-size: 13.5px;
    font-family: 'Instrument Sans', sans-serif;
    cursor: pointer;
    text-align: left;
    transition: background .15s;
}

.ctx-menu button:hover {
    background: var(--surface3);
}

.ctx-menu button i {
    color: var(--accent);
    width: 16px;
}

/* ===========================
   TOAST
=========================== */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--surface2);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 12px 22px;
    border-radius: 100px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s, transform .3s;
    z-index: 999;
    white-space: nowrap;
}

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

/* ===========================
   ANIMATIONS
=========================== */
@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateY(14px);
    }

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

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

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .5;
        transform: scale(1.35);
    }
}

@keyframes tdot {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: .4;
    }

    40% {
        transform: translateY(-7px);
        opacity: 1;
    }
}

/* ===========================
   MOBILE
=========================== */
@media(max-width: 1024px) {
    .suggestion-cards {
        grid-template-columns: repeat(2, 1fr);
        padding: 22px 28px;
    }

    .hero {
        padding: 40px 28px 32px;
    }

    .stats-strip {
        padding: 14px 18px;
    }

    .stat {
        padding: 0 18px;
    }
}

@media(max-width: 768px) {
    .topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        box-shadow: 4px 0 40px rgba(0, 0, 0, .5);
    }

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

    .hero {
        padding: 28px 18px 24px;
    }

    .hero-heading {
        font-size: 30px;
        letter-spacing: -1px;
    }

    .stats-strip {
        flex-wrap: wrap;
        width: 100%;
        padding: 14px;
        gap: 10px;
    }

    .stat {
        padding: 0 14px;
    }

    .suggestion-cards {
        grid-template-columns: 1fr;
        padding: 16px 18px;
    }

    .msg-body-wrap {
        max-width: 84%;
    }

    .composer-hint {
        display: none;
    }
}

@media(max-width: 480px) {
    .scard-arrow {
        display: none;
    }

    .chat-topbar {
        padding: 12px 16px;
    }
}


/* =========================================
   EXTRA MOBILE RESPONSIVE FIXES
   Add at END of assistant.css
========================================= */

/* Tablet */
@media (max-width: 992px) {
    :root {
        --sidebar-w: 260px;
    }

    .hero-heading {
        font-size: 34px;
        line-height: 1.15;
    }

    .stats-strip {
        width: 100%;
        justify-content: space-between;
    }

    .stat {
        flex: 1;
        padding: 0 10px;
    }

    .chat-shell.expanded {
        height: 100%;
    }
}


/* Mobile */
@media (max-width: 768px) {

    html,
    body {
        overflow: hidden;
        height: 100%;
    }

    .app {
        height: 100dvh;
    }

    .main {
        height: 100dvh;
    }

    .topbar {
        display: flex;
        padding: 12px 14px;
    }

    .topbar-brand span {
        font-size: 14px;
    }

    .topbar-btn {
        width: 36px;
        height: 36px;
    }

    /* Sidebar */
    .sidebar {
        width: 85%;
        max-width: 300px;
        min-width: auto;
        z-index: 999;
    }

    .sidebar-inner {
        padding: 20px 16px;
    }

    .sidebar-foot {
        padding: 12px 16px;
    }

    /* Hero */
    .hero {
        padding: 24px 16px 20px;
    }

    .hero-pill {
        font-size: 11px;
        padding: 6px 12px;
        margin-bottom: 16px;
    }

    .hero-heading {
        font-size: 28px;
        line-height: 1.15;
        margin-bottom: 12px;
    }

    .hero-sub {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 20px;
    }

    /* Stats */
    .stats-strip {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
        padding: 14px;
    }

    .stat-divider {
        display: none;
    }

    .stat {
        padding: 0;
    }

    .stat strong {
        font-size: 22px;
    }

    /* Cards */
    .suggestion-cards {
        grid-template-columns: 1fr;
        padding: 14px 16px;
        gap: 10px;
    }

    .scard {
        padding: 16px;
        gap: 14px;
    }

    /* Chat Drawer */
    .chat-shell {
        border-radius: 20px 20px 0 0;
    }

    .chat-shell.expanded {
        height: 100%;
    }

    .chat-topbar {
        padding: 10px 14px;
        font-size: 12px;
        gap: 10px;
        align-items: flex-start;
    }

    .chat-actions {
        gap: 6px;
    }

    .chat-act-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    /* Messages */
    .messages {
        padding: 16px 14px;
        gap: 14px;
    }

    .msg-body-wrap {
        max-width: 90%;
    }

    .msg-bubble {
        padding: 12px 14px;
        font-size: 14px;
        border-radius: 16px;
    }

    .msg-av {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    /* Composer */
    .composer {
        padding: 12px;
    }

    .composer-inner {
        padding: 8px 8px 8px 12px;
        gap: 8px;
        border-radius: 14px;
    }

    textarea#userInput {
        font-size: 14px;
        max-height: 100px;
    }

    .send-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
        border-radius: 10px;
    }

    .composer-hint {
        display: none;
    }

    /* Toast */
    .toast {
        max-width: calc(100% - 30px);
        white-space: normal;
        text-align: center;
    }
}


/* Small Phones */
@media (max-width: 480px) {

    .hero-heading {
        font-size: 24px;
    }

    .brand-text h2 {
        font-size: 15px;
    }

    .brand-text p {
        font-size: 11px;
    }

    .topbar-brand {
        gap: 8px;
    }

    .topbar-brand span {
        font-size: 13px;
    }

    .chat-topbar span {
        font-size: 11px;
        line-height: 1.5;
    }

    .msg-body-wrap {
        max-width: 94%;
    }

    .scard strong {
        font-size: 13px;
    }

    .scard p {
        font-size: 11px;
    }
}


/* ===============================
   MOBILE NAV CLOSE + CHAT FIX
================================ */

.mobile-close-nav {
    display: none;
}

@media (max-width:768px) {

    /* close button */
    .mobile-close-nav {
        display: flex;
        position: absolute;
        top: 14px;
        right: 14px;
        width: 38px;
        height: 38px;
        border: none;
        border-radius: 10px;
        background: #1a2238;
        color: #fff;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        z-index: 1000;
        cursor: pointer;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100dvh;
        z-index: 999;
        overflow-y: auto;
    }

    /* FIX CHAT SHELL HEIGHT */
    .chat-shell {
        height: 110px;
    }

    .chat-shell.expanded {
        height: calc(100dvh - 58px);
        border-radius: 18px 18px 0 0;
    }

    .messages {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }

    .composer {
        padding-bottom: 14px;
    }

    .main {
        height: 100dvh;
    }
}


/* small phones */
@media (max-width:480px) {

    .chat-shell.expanded {
        height: calc(100dvh - 54px);
    }

}