/* ═══════════════════════════════════════════
   SWX BOT — style.css
   Matches Flutter app design exactly
═══════════════════════════════════════════ */

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

/* ── CSS VARIABLES (Dark — default) ── */
:root {
    --bg: #0e1a17;
    --surface: #142420;
    --surface2: #182c27;
    --surface3: #1f3a33;
    --border: rgba(255, 255, 255, 0.06);
    --border2: rgba(255, 255, 255, 0.12);
    --accent: #3e7c6b;
    --accent-dim: rgba(62, 124, 107, 0.12);
    --accent-soft: #8fb3a5;
    --accent-wa: #22c55e;
    --grad: linear-gradient(135deg, #3e7c6b, #6aa895);
    --text: #e6efe9;
    --text2: #9fb3ab;
    --red: #d66b6b;
    --sidebar-w: 288px;
    --font-head: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --msg-font: 14.5px;
    --bubble-r: 18px;
    --bubble-tail: 4px;
}

/* ── LIGHT THEME ── */
body.light {
    --bg: #f0f4f2;
    --surface: #ffffff;
    --surface2: #edf4f0;
    --surface3: #dde8e4;
    --border: rgba(0, 0, 0, 0.07);
    --border2: rgba(0, 0, 0, 0.12);
    --text: #0d1f1a;
    --text2: #4a6b60;
}

body.font-small {
    --msg-font: 12.5px;
}

body.font-large {
    --msg-font: 16.5px;
}

body.bubble-sharp {
    --bubble-r: 6px;
    --bubble-tail: 2px;
}

html,
body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.65;
    overflow: hidden;
    transition: background .3s, color .3s;
}

::-webkit-scrollbar {
    width: 3px;
}

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

/* ══════════════════════════════════════════
   BACKGROUND
══════════════════════════════════════════ */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(143, 179, 165, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, .03) 1px, transparent 1px);
    background-size: 52px 52px;
}

.bg-glow {
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    filter: blur(140px);
    pointer-events: none;
}

.gl-1 {
    width: 700px;
    height: 700px;
    opacity: .18;
    background: radial-gradient(circle, #3e7c6b, transparent 70%);
    top: -200px;
    left: -200px;
    animation: glDrift1 22s ease-in-out infinite alternate;
}

.gl-2 {
    width: 600px;
    height: 600px;
    opacity: .13;
    background: radial-gradient(circle, #22c55e, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation: glDrift2 28s ease-in-out infinite alternate;
}

@keyframes glDrift1 {
    to {
        transform: translate(80px, 60px);
    }
}

@keyframes glDrift2 {
    to {
        transform: translate(-60px, -80px);
    }
}

/* ══════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════ */
.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* ══════════════════════════════════════════
   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: visible;
    position: relative;
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, transparent, rgba(59, 130, 246, .3) 40%, rgba(59, 130, 246, .3) 60%, transparent);
    pointer-events: none;
}

.sidebar-inner {
    flex: 1;
    padding: 24px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    min-height: 0;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.brand-mark span {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 20px;
    color: var(--bg);
}

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

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

.brand-text h2 {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 16px;
    color: var(--text);
}

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

/* New Chat */
.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    background: var(--grad);
    border: none;
    border-radius: 13px;
    color: #fff;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(62, 124, 107, .25);
    transition: filter .2s, transform .15s;
}

.new-chat-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

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

/* History */
.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: 10px;
    transition: border-color .2s, background .2s;
}

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

.history-item.active {
    border-color: rgba(59, 130, 246, .3);
    background: rgba(59, 130, 246, .07);
}

.hist-label {
    flex: 1;
    font-size: 12.5px;
    color: #ffffffb3;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.history-item:hover .hist-label {
    color: #fff;
}

.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;
}

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

.hist-btn.del:hover {
    color: var(--red);
}

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

/* Sidebar Footer */
.sidebar-foot {
    padding: 12px 18px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Quick Actions */
.quick-actions-wrap {
    display: flex;
    flex-direction: column;
}

.qa-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text2);
    font-size: 11px;
    font-family: var(--font-body);
    cursor: pointer;
    letter-spacing: 1.4px;
    transition: color .2s, background .2s;
}

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

.qa-icon {
    font-size: 10px;
    transition: transform .3s;
}

.qa-icon.open {
    transform: rotate(180deg);
}

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

.qa-items.open {
    max-height: 300px;
}

.nav-item {
    width: 100%;
    padding: 10px 11px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 11px;
    color: var(--text2);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    text-align: left;
    transition: background .2s, border-color .2s, color .2s;
}

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

/* Foot Buttons */
.foot-btns {
    display: flex;
    gap: 8px;
}

.foot-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text2);
    font-size: 12px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}

.foot-btn:hover {
    background: var(--surface3);
    border-color: var(--border2);
    color: var(--text);
}

/* Mobile close */
.mobile-close {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
    background: var(--surface3);
    border: none;
    border-radius: 10px;
    color: var(--text);
    font-size: 17px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

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

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

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
}

.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(--accent);
}

/* Main Scroll */
.main-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 112px;
    transition: opacity .3s;
}

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

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

.hero-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(59, 130, 246, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 130, 246, .04) 1px, transparent 1px);
    background-size: 48px 48px;
}

.hero-orb {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(80px);
}

.orb-1 {
    width: 400px;
    height: 400px;
    opacity: .1;
    background: radial-gradient(circle, #3b82f6, transparent 70%);
    top: -100px;
    right: -80px;
    animation: orbFloat1 18s ease-in-out infinite alternate;
}

.orb-2 {
    width: 300px;
    height: 300px;
    opacity: .08;
    background: radial-gradient(circle, #22c55e, transparent 70%);
    bottom: -80px;
    left: 20%;
    animation: orbFloat2 22s ease-in-out infinite alternate;
}

@keyframes orbFloat1 {
    to {
        transform: translate(-40px, 30px);
    }
}

@keyframes orbFloat2 {
    to {
        transform: translate(40px, -20px);
    }
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--accent-dim);
    border: 1px solid rgba(59, 130, 246, .22);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    margin-bottom: 22px;
    font-family: var(--font-head);
    animation: fadeSlide .6s ease both;
}

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

@keyframes pillPulse {

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

    50% {
        opacity: .4;
        transform: scale(1.4);
    }
}

.hero-heading {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: clamp(28px, 3.8vw, 52px);
    line-height: 1.08;
    letter-spacing: -1.5px;
    color: var(--text);
    margin-bottom: 16px;
    max-width: 680px;
    animation: fadeSlide .6s .1s ease both;
}

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

.hero-sub {
    font-size: 15.5px;
    color: var(--text2);
    max-width: 540px;
    line-height: 1.75;
    margin-bottom: 32px;
    font-weight: 300;
    animation: fadeSlide .6s .2s ease both;
}

.stats-strip {
    display: flex;
    align-items: center;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 16px;
    padding: 18px 28px;
    width: fit-content;
    animation: fadeSlide .6s .3s ease both;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, .08), 0 4px 24px rgba(0, 0, 0, .3);
}

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

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

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

.stat-div {
    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, box-shadow .2s;
    position: relative;
    overflow: hidden;
    animation: fadeSlide .5s ease both;
}

.scard::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0;
    transition: opacity .2s;
}

.scard:hover::before {
    opacity: 1;
}

.scard:hover {
    border-color: rgba(59, 130, 246, .3);
    background: var(--surface2);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .3);
}

.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-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--accent-dim);
    border: 1px solid rgba(59, 130, 246, .15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    color: var(--accent);
    flex-shrink: 0;
    transition: background .2s, box-shadow .2s;
}

.scard:hover .scard-icon {
    background: rgba(59, 130, 246, .18);
    box-shadow: 0 0 16px rgba(59, 130, 246, .2);
}

.scard-text strong {
    display: block;
    font-size: 13.5px;
    margin-bottom: 3px;
    font-weight: 600;
}

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

/* ══════════════════════════════════════════
   CHAT SHELL
══════════════════════════════════════════ */
.chat-shell {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 80px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 1px solid rgba(59, 130, 246, .2);
    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;
    box-shadow: 0 -8px 48px rgba(0, 0, 0, .5), 0 -1px 0 rgba(59, 130, 246, .12);
}

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

.chat-shell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, .5), transparent);
    pointer-events: none;
}

/* Handle */
.drawer-handle {
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: grab;
    flex-shrink: 0;
    padding: 8px 0 4px;
    user-select: none;
    -webkit-user-select: none;
}

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

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

.drawer-handle:hover .handle-bar {
    background: rgba(59, 130, 246, .5);
    width: 50px;
}

.handle-label {
    font-size: 10px;
    color: var(--text2);
    letter-spacing: .1em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-head);
    font-weight: 600;
    transition: opacity .2s;
}

.handle-label i {
    font-size: 9px;
    color: var(--accent);
}

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

/* Chat Topbar */
.chat-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    font-size: 13px;
    color: #ffffffb3;
    flex-shrink: 0;
    gap: 12px;

    position: sticky;
    top: 0;
    z-index: 40;
}

.chat-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.chat-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-wa);
    flex-shrink: 0;
    box-shadow: 0 0 8px var(--accent-wa);
    animation: pillPulse 2s infinite;
}

.chat-topbar strong {
    color: var(--accent-soft);
    font-family: var(--font-head);
}

.chat-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

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

.chat-act-btn:hover {
    color: var(--accent);
    border-color: rgba(59, 130, 246, .3);
    background: var(--accent-dim);
}

/* Search Bar */
.chat-search-bar {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 22px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 60px;
    z-index: 39;
}

.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: var(--font-body);
    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: 22px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.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: 12px;
    font-weight: 800;
    flex-shrink: 0;
    font-family: var(--font-head);
}

.msg-row.bot .msg-av {
    background: var(--grad);
    color: #fff;
}

.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: 4px;
}

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

.msg-bubble {
    padding: 13px 17px;
    border-radius: var(--bubble-r);
    font-size: var(--msg-font);
    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: var(--bubble-tail);
    color: var(--text);
}

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

/* Markdown */
.msg-bubble h1,
.msg-bubble h2,
.msg-bubble h3 {
    font-family: var(--font-head);
    margin: 10px 0 6px;
    color: #fff;
}

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

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

.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: 18px;
    margin: 6px 0;
}

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

.msg-bubble code {
    background: rgba(59, 130, 246, .1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: var(--accent);
}

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

.msg-bubble pre code {
    background: none;
    padding: 0;
    color: var(--text);
}

.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-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: var(--bubble-r);
    border-bottom-left-radius: var(--bubble-tail);
    padding: 13px 17px;
}

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

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    opacity: .5;
    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 */
.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%;
    height: 1px;
    background: var(--border);
    width: 30%;
}

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

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

mark {
    background: rgba(59, 130, 246, .25);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* Reco Bar */
.reco-bar {
    padding: 10px 20px 12px;
    border-top: 1px solid var(--border);
    background: var(--surface2);
}

.reco-top {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--accent);
    font-family: var(--font-head);
    font-weight: 600;
    letter-spacing: .08em;
    margin-bottom: 8px;
}

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

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

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

/* Composer */
.composer {
    padding: 14px 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 .25s, box-shadow .25s;
}

.composer-inner:focus-within {
    border-color: rgba(59, 130, 246, .4);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .08);
}

textarea#userInput {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    resize: none;
    font-family: var(--font-body);
    font-size: var(--msg-font);
    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(--grad);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(62, 124, 107, .3);
    transition: opacity .2s, transform .15s;
}

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

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

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

/* ══════════════════════════════════════════
   TOAST
══════════════════════════════════════════ */
.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--surface2);
    border: 1px solid rgba(59, 130, 246, .3);
    color: var(--text);
    padding: 11px 22px;
    border-radius: 999px;
    font-size: 13px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s, transform .3s;
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}

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

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .54);
    z-index: 190;
}

.sidebar-overlay.open {
    display: block;
}

/* ══════════════════════════════════════════
   MODALS
══════════════════════════════════════════ */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(4px);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
    animation: modalIn .25s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(.93) translateY(12px);
    }

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.modal-close {
    width: 32px;
    height: 32px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text2);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color .2s;
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.modal-body::-webkit-scrollbar {
    width: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border2);
    border-radius: 2px;
}

/* Settings sections */
.settings-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-label {
    font-size: 11px;
    letter-spacing: 1.2px;
    color: var(--accent);
    font-weight: 600;
    font-family: var(--font-head);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

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

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.setting-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

.setting-desc {
    font-size: 12px;
    color: var(--text2);
}

/* Toggle Group */
.toggle-group {
    display: flex;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
    flex-shrink: 0;
}

.tgl-opt {
    padding: 6px 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text2);
    cursor: pointer;
    font-size: 12px;
    font-family: var(--font-body);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background .2s, color .2s;
    white-space: nowrap;
}

.tgl-opt.active {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    border-radius: 100px;
    background: var(--surface2);
    border: 1px solid var(--border);
    transition: background .25s;
}

.slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    border-radius: 50%;
    background: var(--text2);
    transition: transform .25s, background .25s;
}

input:checked+.slider {
    background: var(--accent-dim);
    border-color: var(--accent);
}

input:checked+.slider::before {
    transform: translateX(18px);
    background: var(--accent);
}

/* Select */
.setting-select {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 7px 10px;
    font-family: var(--font-body);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
}

.setting-select:focus {
    border-color: var(--accent);
}

/* Action Buttons */
.action-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: border-color .2s, background .2s;
    flex-shrink: 0;
}

.action-btn:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.action-btn.danger {
    color: var(--red);
}

.action-btn.danger:hover {
    border-color: var(--red);
    background: rgba(214, 107, 107, .08);
}

/* About Card */
.about-card {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.about-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #4d7cff, #9a5cff);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 14px;
    flex-shrink: 0;
}

.about-card strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
    font-size: 14px;
}

.about-card p {
    font-size: 12.5px;
    color: var(--text2);
    line-height: 1.55;
}

/* Help Steps */
.help-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.help-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 13px;
    color: var(--text2);
}

.help-step strong {
    color: var(--text);
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 1px solid rgba(62, 124, 107, .22);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-head);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Shortcuts */
.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.shortcut-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 16px;
    font-size: 12.5px;
    color: var(--text2);
    background: var(--surface2);
    border-bottom: 1px solid var(--border);
}

.shortcut-row:last-child {
    border-bottom: none;
}

kbd {
    background: var(--surface3);
    border: 1px solid var(--border2);
    border-radius: 5px;
    padding: 2px 7px;
    font-size: 11px;
    font-family: var(--font-body);
    color: var(--text);
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.faq-item {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.faq-q {
    width: 100%;
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    text-align: left;
    font-weight: 500;
}

.faq-q i {
    color: var(--text2);
    font-size: 11px;
    transition: transform .2s;
    flex-shrink: 0;
}

.faq-q.open i {
    transform: rotate(180deg);
}

.faq-a {
    display: none;
    padding: 0 16px 13px;
    font-size: 12.5px;
    color: var(--text2);
    line-height: 1.6;
}

.faq-a.open {
    display: block;
}

/* Contact Cards */
.contact-cards {
    display: flex;
    gap: 10px;
}

.contact-card {
    flex: 1;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
    transition: border-color .2s, background .2s;
}

.contact-card:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.contact-card i {
    font-size: 20px;
    color: var(--accent);
}

.contact-card span {
    font-size: 13px;
    color: var(--text);
    font-weight: 500;
}

.contact-card small {
    font-size: 11px;
    color: var(--text2);
}


.back-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    z-index: 400;
    /* above the overlay at 300 */
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    pointer-events: auto;
    min-height: 46px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .05));
    border: 1px solid var(--border);
    color: var(--text2);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-body);
    transition: background .22s, border-color .22s, color .22s, transform .18s;
}

.sidebar-foot {
    position: relative;
    z-index: 10;
}

.back-link i {
    font-size: 12px;
    transition: transform .2s ease;
}

.back-link:hover {
    background: var(--surface2);

    border-color:
        rgba(59, 130, 246, .28);

    color: var(--text);

    transform: translateY(-1px);
}

.back-link:hover i {
    transform: translateX(-2px);
}


/* ══════════════════════════════════════════
   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 tdot {

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

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

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

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 300px;
        min-width: auto;
        height: 100dvh;
        z-index: 300;
        transform: translateX(-100%);
        box-shadow: 4px 0 40px rgba(0, 0, 0, .6);
    }

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

    .mobile-close {
        display: flex;
    }


    .stat-div {
        display: none;
    }


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

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

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

    .stats-strip {
        width: 100%;
        padding: 14px 10px;
        justify-content: space-between;
        gap: 8px;
    }

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

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

    .stat span {
        font-size: 10px;
    }

    .stat-div {
        height: 28px;
    }

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

    .scard {
        padding: 16px;
    }

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

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

    .chat-shell {
        border-radius: 20px 20px 0 0;
        height: 80px;
    }

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

    .messages {
        padding: 16px 14px;
    }

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

    .composer {
        padding: 12px;
    }

    .modal {
        margin: 10px;
    }
}

@media (max-width: 768px) {

    .sidebar {
        overflow-y: auto;
    }

    .sidebar-foot {
        padding-bottom: 34px;
    }

    .back-link {
        touch-action: manipulation;
    }
}

@media (max-width: 768px) {

    .stats-strip {
        width: 100%;
        padding: 14px 10px;

        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;

        gap: 0;

        overflow: hidden;
    }

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

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

    .stat span {
        font-size: 10px;
        line-height: 1.35;
    }

    .stat-div {
        height: 34px;
    }
}

/* ─────────────────────────
   POWERED BY SOLWORXS
───────────────────────── */
.powered-by-solworxs {
    margin-top: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
}

.powered-text {
    font-size: 0.82rem;
    color: #a1a8b8;
    font-weight: 400;
}

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

.powered-name {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.01em;
}

.powered-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    transform: translateY(1px);
}

.powered-s {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
}

/* ═══════════════════════════════════════════
   MOBILE RESPONSIVE FIXES
═══════════════════════════════════════════ */

@media (max-width: 768px) {

    body {
        overflow: hidden;
    }

    .topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        width: 82%;
        max-width: 320px;
        transform: translateX(-100%);
        transition: transform .3s ease;
        z-index: 999;
    }

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

    .mobile-close {
        display: flex;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .45);
        backdrop-filter: blur(3px);
        opacity: 0;
        visibility: hidden;
        transition: .3s;
        z-index: 998;
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .main {
        width: 100%;
    }
}

@media (max-width: 768px) {

    .messages {
        padding: 14px;
    }

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

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

@media (max-width: 768px) {

    .composer {
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    }

    .composer-inner {
        padding: 8px 8px 8px 12px;
    }

    textarea#userInput {
        font-size: 16px;
    }

    .send-btn {
        width: 42px;
        height: 42px;
    }
}