html {
  font-size: clamp(16px, 1.05vw, 18px);
  scroll-behavior: smooth;
}
/* html.dynamic-font-embed {
  font-size: clamp(16px, 1.05vw, 18px);
} */

body {
    font-family: "Inter", sans-serif;
    background-color: #f8f9fa;
}
.form-control {
    font-size: 0.875rem !important;
}
.fs-9 {
    font-size: 0.56rem !important;
}
.fs-10 {
    font-size: 0.625rem !important;
}
.fs-11 {
    font-size: 0.725rem !important;
}
.fs-12 {
    font-size: 0.75rem !important;
}
.fs-13 {
    font-size: 0.815rem !important;
}
.fs-14 {
    font-size: 0.875rem !important;
}

#chat-window {
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chat-card {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#chat-card.standalone {
    max-width: 60vw;
    max-height: 99vh;
    max-height: 99dvh;
    margin-left: auto;
    margin-right: auto;
}
@media screen and (max-width: 768px) {
    #chat-card {
        max-width: unset !important;
        max-height: unset !important;
    }
}
@media screen and (min-width: 768px) {
    #chat-container {
        padding-inline: 15vw !important;
    }
    .input-box {
        margin-inline: 15vw !important;
    }
}

#chat-container {
    flex-grow: 1;
}
#hero-input {
    align-content: center !important;
}
/* Hero overlay - initial screen */
.hero-overlay {
    position: absolute;
    inset: 64px 0 72px 0; /* leave header and footer space */
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* prevent intercept when not active */
}
.hero-overlay .hero-content { pointer-events: auto; }
.hero-content { position: relative; }
/* Keep hero title centered; position input below center so it grows downward */
.hero-input-group {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: calc(50% + 40px); /* below the centered title */
    width: min(720px, 92vw);
    align-items: flex-end;
}
.hero-title {
    font-size: clamp(16px, 2.2vw, 22px);
    color: rgba(15,23,42,0.65);
}
#hero-brand-title .brand-orbit { display: none; }
html.embed-false #hero-brand-title .brand-cropin { display: none; }
html.embed-false #hero-brand-title .brand-orbit { display: inline; }
.hero-input-group .form-control.user-input {
    background: #e9ecef;
    border-radius: 1rem !important;
    resize: none; /* auto-resize via JS */
    overflow-y: auto;
    scrollbar-gutter: stable both-edges; /* keep scrollbar space inside */
    background-clip: padding-box;
}
.hero-input-group .form-control.user-input:focus {
    background: none !important;
}
.hero-input-group .btn {
    border-radius: 0 1rem 1rem 0;
}
.input-box {
    border-radius: 3rem;
    margin: 0rem 1rem 0.5rem 1rem;
    box-shadow: 0 -4px 8px 0px #0000000d;
}
.bottom-input-group {
    align-items: flex-end !important;
}
html[data-theme='dark'] .bottom-input-group .form-control.user-input {
    background-color: inherit;
}
/* When hero is active, keep footer hidden and center input */
#chat-card.hero-active .input-box { display: none; }
#chat-card.hero-active .hero-overlay { display: flex; }

/* In embed mode, never show the hero overlay and keep input visible */
html.embed-true #chat-card.hero-active .hero-overlay { display: none !important; }
html.embed-true #chat-card.hero-active .input-box { display: block !important; }

.bottom-credit {
    position: absolute;
    bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 8px;
    white-space: pre;
}
.logo-container {
    position: relative;
}
.powered-by {
    position: absolute;
    bottom: -18px;
    left: 0;
}
.brand-logo { height: 24px; vertical-align: middle; }
.brand-orbit { display: none; }
html.embed-false .brand-cropin { display: none; }
html.embed-false .brand-orbit { display: inline; }
.hidden-copy-session-id-btn {
    position: absolute;
    width: 23px;
    height: 100%;
    cursor: pointer;
}
.welcome-text {
    white-space: pre-line;
    span {
        font-weight: bold;
    }
}
/* Custom scrollbar*/
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

#new-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    font-size: 0.875rem;
}
#logout-btn {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    font-size: 0.875rem;
}


.blinking-cursor {
    display: inline-block;
    width: 8px;
    height: 1.2rem;
    background-color: #333;
    animation: blink 1s step-end infinite;
}

@keyframes blink {

    from,
    to {
        background-color: transparent;
    }

    50% {
        background-color: #333;
    }
}

.avatar {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.user-avatar {
    background-color: #63c5e5;
}

.bot-message-bubble {
    background-color: #e9ecef;
    border-radius: 1rem;
    border-top-left-radius: 0;
    max-width: 85%;
}

.user-message-bubble {
    background-color: #00a2c5;
    color: white;
    border-radius: 1rem;
    border-bottom-right-radius: 0;
    max-width: 85%;
}

.bot-message-bubble>*:last-child,
.user-message-bubble>*:last-child {
    margin-bottom: 0;
}

.bot-message-bubble p,
.user-message-bubble p {
    margin: 0;
}

/* Styles for rendered markdown */
.bot-message-bubble ul,
.bot-message-bubble ol {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Login brand title toggles */
#login-brand-title .brand-orbit { display: none; }
html.embed-false #login-brand-title .brand-cropin { display: none; }
html.embed-false #login-brand-title .brand-orbit { display: inline; }

.bot-message-bubble ul {
    list-style-type: disc;
}

.bot-message-bubble ol {
    list-style-type: decimal;
}

.bot-message-bubble a {
    color: #0d6efd;
    text-decoration: underline;
}

.bot-message-bubble pre {
    position: relative;
    background-color: #212529;
    color: #f8f9fa;
    padding: 1.5rem 1rem 1rem;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    overflow-x: auto;
}

.bot-message-bubble code {
    color: #d63384;
    background-color: #f8f9fa;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: monospace;
}

.bot-message-bubble pre code {
    color: inherit;
    background-color: transparent;
    padding: 0;
}

.copy-code-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: #495057;
    color: #f8f9fa;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 0.2s;
}

.copy-code-btn:hover {
    background-color: #6c757d;
}
.bot-message-bubble.aborted {
    font-style: italic;
}
/* Hover-only copy button under each message bubble */
.chat-message { position: relative; }
.chat-message .message-copy-btn {
    position: absolute;
    bottom: -16px; /* sit just below bubble */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    opacity: 0;
    pointer-events: none; /* only active on hover of parent */
    transition: opacity 120ms ease;
}
.chat-message .message-copy-btn img { width: 16px; height: 16px; display: block; }
.chat-message:hover .message-copy-btn { opacity: 1; pointer-events: auto; }
/* Align under respective side */
.chat-message.from-bot .message-copy-btn { left: 58px; }
.chat-message.from-user .message-copy-btn { right: 44px; }
/* Ensure bubbles have extra bottom spacing to avoid overlap */
.bot-message-bubble, .user-message-bubble { margin-bottom: 4px; }
.user-input {
    /* background-color: #e9ecef; */
    box-shadow: none;
    border-radius: 2rem !important;
    resize: none;
    overflow-y: auto;
    scrollbar-gutter: stable both-edges;
    background-clip: padding-box;
    min-height: 40px !important;
}
.user-input-bottom {
    padding-top: 0.5rem !important;
}
.send-btn {
    border-radius: 3rem !important;
}
.send-btn:hover {
    background: rgba(0,162,197,0.08);
}
.stop-btn {
    border-radius: 1rem !important;
    margin-left: 1rem;
}
.stop-btn:hover {
    background-color: darkgray;
}
.form-control:focus {
    box-shadow: 0 0 0 1px rgba(13, 110, 253, .25) !important;
}
.user-input-bottom.form-control:focus {
    box-shadow: none !important;
}

/* Dictation (speech input) */
.dictate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--color-primary);
    border: 1px solid transparent;
    border-radius: 3rem !important;
    transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
    position: relative;
    left: 0.5rem !important;
}
.dictate-btn:hover { background: rgba(0,162,197,0.08); }
.dictate-btn.recording { color: #dc3545; }
html[data-theme='dark'] .dictate-btn { color: var(--color-primary); }
html[data-theme='dark'] .dictate-btn:hover { background: rgba(255,255,255,0.08); }
html[data-theme='dark'] .dictate-btn.recording { color: #f87171; }

.dictation-overlay-inline {
    position: absolute;
    right: 0;
    bottom: 100%;
    transform: translateY(-0.5rem);
    background: var(--color-card, #fff);
    border: 1px solid var(--color-border, rgba(0,0,0,0.1));
    padding: .5rem .75rem;
    border-radius: .75rem;
    box-shadow: var(--shadow-md, 0 8px 24px rgba(0,0,0,0.15));
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: 260px;
    z-index: 2000;
    animation: scaleIn 160ms ease;
}
html[data-theme='dark'] .dictation-overlay-inline { background: #0f172a; }
.dictation-waveform {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 28px;
}
.dictation-waveform .bar {
    flex: 1 0 0;
    background: linear-gradient(180deg, var(--color-primary), var(--color-quaternary));
    width: 4px;
    border-radius: 2px;
    animation: wf 600ms ease-in-out infinite;
    transform-origin: bottom;
}
.dictation-waveform .bar:nth-child(2) { animation-delay: 120ms; }
.dictation-waveform .bar:nth-child(3) { animation-delay: 240ms; }
.dictation-waveform .bar:nth-child(4) { animation-delay: 360ms; }
.dictation-waveform .bar:nth-child(5) { animation-delay: 480ms; }
@keyframes wf { 0%,100% { height: 4px; } 50% { height: 100%; } }
.dictation-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.dictation-actions button {
    border: 1px solid var(--color-border, rgba(0,0,0,0.1));
    background: transparent;
    padding: .25rem .5rem;
    border-radius: .5rem;
    font-size: .75rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-primary);
}
.dictation-actions button.confirm { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.dictation-actions button.confirm:hover { background: #008aa7; }
.dictation-actions button.cancel:hover { background: rgba(0,0,0,0.05); }
html[data-theme='dark'] .dictation-actions button.cancel:hover { background: rgba(255,255,255,0.08); }
html[data-theme='dark'] .dictation-actions button { color: var(--color-quaternary); border-color: var(--color-border); }
html[data-theme='dark'] .dictation-actions button.confirm { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

/* === Inline Dictation Redesigned (waveform inside input area) === */
.dictation-inline {
    position: absolute;
    right: .5rem;
    bottom: .35rem;
    display: flex;
    align-items: center;
    gap: .8rem;
    z-index: 30;
    pointer-events: none;
}
.hero-input-group.dictating textarea::placeholder {
  line-height: 0; /* reset any browser weirdness for placeholder */
}

.dictation-inline .dictation-bars, .dictation-inline .dictation-dots { display:flex; align-items:flex-end; gap:3px; height:28px; width:120px; pointer-events:none; }
.dictation-inline .dictation-bars .bar { width:6px; background:linear-gradient(180deg, var(--color-primary), var(--color-quaternary)); border-radius:3px; height:6px; transition:height 90ms ease; }
html[data-theme='dark'] .dictation-inline .dictation-bars .bar { background:linear-gradient(180deg, var(--color-quaternary), var(--color-primary)); }
.dictation-inline .dictation-dots span { width:6px; height:6px; background:var(--color-primary); border-radius:50%; opacity:.35; animation:dots-blink 1.2s ease-in-out infinite; }
.dictation-inline .dictation-dots span:nth-child(2){ animation-delay:.2s; }
.dictation-inline .dictation-dots span:nth-child(3){ animation-delay:.4s; }
@keyframes dots-blink { 0%,100%{opacity:.2; transform:translateY(0);} 50%{opacity:.9; transform:translateY(-4px);} }
.dictation-inline .dictation-ctrls { display:flex; gap:.4rem; pointer-events:auto; }
.dictation-inline .dictation-ctrls button { width:32px; height:32px; border-radius:50%; border:1px solid var(--color-border, rgba(0,0,0,0.15)); display:inline-flex; align-items:center; justify-content:center; background:var(--color-card,#fff); color:var(--color-primary); cursor:pointer; font-size:16px; line-height:1; transition:background-color 140ms ease, color 140ms ease, box-shadow 140ms ease; }
html[data-theme='dark'] .dictation-inline .dictation-ctrls button { background:#0f172a; color:var(--color-quaternary); }
.dictation-inline .dictation-ctrls button:hover { background:var(--color-primary); color:#fff; }
html[data-theme='dark'] .dictation-inline .dictation-ctrls button:hover { background:var(--color-primary); color:#fff; }
.dictation-inline .dictation-ctrls button.confirm { background:var(--color-primary); color:#fff; }
.dictation-inline .dictation-ctrls button.confirm:hover { filter:brightness(.92); }
.dictation-inline .dictation-ctrls button.cancel:hover { background:#dc3545; color:#fff; }
html[data-theme='dark'] .dictation-inline .dictation-ctrls button.cancel:hover { background:#ef4444; }
/* .input-group.dictating textarea.user-input { padding-right:170px; }
@media (max-width:640px){ .input-group.dictating textarea.user-input { padding-right:140px; } } */

/* Hide mic & send buttons during active dictation */
.input-group.dictating #mic-btn,
.input-group.dictating #send-btn,
.input-group.dictating #hero-mic-btn,
.input-group.dictating #hero-send-btn { opacity:0; visibility:hidden; pointer-events:none; transition:opacity 120ms ease; }
.input-group:not(.dictating) #mic-btn,
.input-group:not(.dictating) #send-btn,
.input-group:not(.dictating) #hero-mic-btn,
.input-group:not(.dictating) #hero-send-btn { opacity:1; visibility:visible; }


.ai-infinity-border {
    position: relative;
    top: -10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 43px;
    height: 41px;
}
.ai-infinity-border.emdeded {
    width: 42px;
}

.ai-infinity-border-arc {
    position: absolute;
    top: 0;
    left: 0;
    width: 42px;
    height: 42px;
    pointer-events: none;
    z-index: 1;
}

.ai-infinity-border-arc svg {
    width: 42px;
    height: 42px;
    display: block;
}

.ai-infinity-border-arc-path {
    stroke: #22c55e;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-dasharray: 60 60;
    stroke-dashoffset: 0;
    transform-origin: 50% 50%;
    animation: ai-infinity-arc-spin 1s linear infinite;
}
@keyframes ai-infinity-arc-spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Popup notification for session ID copy */
.popup-notification {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: #22ae56;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 9999;
    font-size: 0.825rem;
    opacity: 0;
    transition: opacity 0.5s;
}
.popup-notification.error {
    background: #dc3545;
}

.fullscreen-btn {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background-color: #f8f9fa;
    color: #495057;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    box-shadow:0 2px 8px rgba(0,0,0,0.1);
}
/* Shimmer animation for thinking message */
.shimmer-background {
    background: linear-gradient(to right, #e9ecef 0%, #f8f9fa 20%, #e9ecef 40%, #e9ecef 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
}
/* Thinking text legibility on shimmer */
.shimmer-background .text-muted.fst-italic {
    color: #495057 !important; /* boost contrast in light mode */
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Sessions history overlay - left drawer */
.sessions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 88%;
    max-width: 500px;
    background: rgba(255,255,255,0.98);
    border-right: 1px solid #e5e7eb;
    box-shadow: 2px 0 12px rgba(0,0,0,0.06);
    transform: translateX(-100%);
    transition: transform 280ms ease;
    z-index: 20;
}
.sessions-overlay.open {
    transform: translateX(0);
}

/* Backdrop behind sessions overlay */
.sessions-backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(15, 23, 42, 0.25); /* slate-900 @ 45% */
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
    z-index: 10; /* just under the overlay */
}
.sessions-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
.sessions-overlay .overlay-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.5rem 1rem 1rem;
}
.sessions-overlay .overlay-header {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.98);
    z-index: 1;
}
.sessions-search-toggle { line-height:1; display:inline-flex; align-items:center; gap:.25rem; color: var(--color-primary); border-color: var(--color-primary); background:transparent; }
.sessions-search-toggle svg { width:18px; height:18px; }
.sessions-search-toggle:hover, .sessions-search-toggle:focus { background: var(--color-primary); color:#fff; border-color: var(--color-primary); }
html[data-theme='dark'] .sessions-search-toggle { color: var(--color-primary); border-color: var(--color-primary); background:transparent; }
html[data-theme='dark'] .sessions-search-toggle:hover, html[data-theme='dark'] .sessions-search-toggle:focus { background: var(--color-primary); color:#fff; }
.sessions-search-bar { overflow: hidden; transition: max-height 260ms ease, opacity 200ms ease; max-height:0; opacity:0; }
.sessions-search-bar.open { max-height:120px; opacity:1; }
.sessions-search-bar .search-inner { display:flex; align-items:center; }
.sessions-search-input { padding-right:2rem; background:#f8fafc; }
html[data-theme='dark'] .sessions-search-input { background:#1e293b; color:#f1f5f9; border-color:#334155; }
html[data-theme='dark'] .sessions-search-input:focus { background:#1e293b; color:#fff; }
html[data-theme='dark'] .sessions-search-input::placeholder { color:#64748b; opacity:1; }
/* Empty sessions message styling */
.empty-sessions-msg { color:#475569; }
html[data-theme='dark'] .empty-sessions-msg { color:#cbd5e1; }
.sessions-search-clear { position:absolute; right:.25rem; top:50%; transform:translateY(-50%); color:#64748b; text-decoration:none; font-size:1.1rem; padding:.125rem .25rem; }
.sessions-search-clear:hover { color:#0f172a; }
/* spinner removed */
html[data-theme='dark'] .sessions-search-clear { color:#94a3b8; }
html[data-theme='dark'] .sessions-search-clear:hover { color:#fff; }
/* spinner removed */
.sessions-overlay .overlay-list {
    overflow-y: auto;
    font-size: small;
    max-height: calc(100% - 48px);
}
.sessions-overlay .list-loading {
    padding: 0.5rem;
    overflow: unset;
}
.sessions-overlay .list-group-item {
    cursor: pointer;
}
.sessions-overlay .list-group-item .session-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.sessions-overlay .list-group-item.active {
    /* border-left: 4px solid #00a2c5; */
    background-color: #00a2c5;
    border: none !important;
}
/* small utility area for actions */
.session-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
/* Session actions: hover-only kebab and dropdown menu */
.list-group-item .session-actions {
    position: relative;
    display: flex;
    align-items: center;
}

.list-group-item .session-actions .kebab-btn {
    background: transparent;
    border: none;
    line-height: 1;
    font-size: 18px;
    padding: 4px 6px;
    border-radius: 6px;
    color: #6c757d; /* muted */
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, background-color 120ms ease, color 120ms ease;
}

.list-group-item:hover .session-actions .kebab-btn,
.list-group-item .session-actions.open .kebab-btn {
    opacity: 1;
    pointer-events: auto;
}

/* Keep kebab visible for the selected (active) session */
.list-group-item.active .session-actions .kebab-btn {
    opacity: 1;
    pointer-events: auto;
    color: #fff;
}

.list-group-item.active .session-actions .kebab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.list-group-item .session-actions .kebab-btn:hover {
    background: rgba(0,0,0,0.06);
    color: #343a40;
}

.list-group-item .session-actions .session-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 160px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    padding: 6px 0;
    display: none;
    z-index: 5;
}

.list-group-item .session-actions.open .session-menu {
    display: block;
}

.list-group-item .session-actions .session-menu-item {
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 12px;
    font-size: 14px;
    color: #212529;
    cursor: pointer;
}

.list-group-item .session-actions .session-menu-item:hover {
    background: rgba(0,0,0,0.05);
}
.list-group-item .session-actions .session-menu-item.text-danger { color: #dc3545; }
.list-group-item .session-actions .session-menu-item.text-danger:hover { background: rgba(220,53,69,0.08); }
.session-actions .btn-icon {
    border: none;
    background: transparent;
    color: #64748b;
    padding: 0.125rem 0.25rem;
}
.session-actions .btn-icon:hover {
    color: #0f172a;
}

/* Simple spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-top-color: #00a2c5;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Rename modal */
.rename-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* Improve separation from background */
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.rename-modal-overlay.open {
    display: flex;
}
.rename-modal-dialog {
    background: #fff;
    width: min(92vw, 420px);
    border-radius: 0.5rem;
    padding: 0.75rem 0.75rem 0.75rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    /* Subtle boundary in light mode */
    border: 1px solid var(--color-border);
}

/* Login overlay */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.login-card {
    position: relative;
    overflow: hidden;
    width: min(92vw, 400px);
    min-height: 380px;
    border-radius: 0.75rem;
    padding: 1.25rem 1.25rem 1rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,255,255,0.88));
    border: 1px solid rgba(13,110,253,0.08);
    box-shadow: 0 18px 40px rgba(2,6,23,0.18);
    -webkit-backdrop-filter: blur(10px) saturate(1.05);
    backdrop-filter: blur(10px) saturate(1.05);
    display: flex;
    flex-direction: column;
    justify-content: center; /* center content vertically */
    align-items: stretch;
    gap: 1rem; /* consistent spacing between title, error, and form */
}
.login-card::before {
    /* Brand accent bar at the top */
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00a2c5, #0d6efd, #22ae56);
}
.login-card::after {
    /* Soft corner glow */
    content: "";
    position: absolute;
    width: 260px; height: 260px;
    right: -140px; bottom: -140px;
    background: radial-gradient(closest-side, rgba(0,162,197,0.22), transparent 70%);
    filter: blur(10px);
    pointer-events: none;
}
/* Subtle heading tint */
.login-card h5, .login-card .card-title {
    color: #0d6efd;
    font-weight: 600;
}
/* Inputs within the login card */
.login-card .form-control {
    background-color: #f8fafc;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 0.5rem;
}
.login-card .form-control:focus {
    border-color: #00a2c5;
    box-shadow: 0 0 0 .2rem rgba(0, 162, 197, .2) !important;
}
/* Primary action button inside login card */
.login-card #login-submit, .login-card .btn-primary {
    background-color: #00a2c5;
    border-color: #00a2c5;
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 162, 197, 0.25);
}
.login-card #login-submit:hover, .login-card .btn-primary:hover {
    background-color: #008aa7;
    border-color: #008aa7;
}
.login-card #login-submit:focus-visible, .login-card .btn-primary:focus-visible {
    box-shadow: 0 0 0 .2rem rgba(0, 162, 197, .35) !important;
}
/* Error text */
#login-error { color: #d63384; font-weight: 500; min-height: 1.125rem; }
/* Ensure error appears above the login button */
.login-card .d-flex.justify-content-between.align-items-center {
    display: grid !important;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.5rem;
}
/* Layout and spacing inside login card */
.login-card h5, .login-card .card-title { margin-bottom: 0.5rem; }
.login-card form {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 0.75rem;
}
@media (min-width: 480px) {
    .login-card form { gap: 1rem; }
}
.login-card label { margin-bottom: 0.25rem; color: #334155; font-weight: 500; }
.login-card .form-group,
.login-card .input-group,
.login-card .form-floating,
.login-card .mb-3 { margin-bottom: 0 !important; }
.login-card .form-control { width: 100%; }
.login-card .btn { width: 100%; min-height: 44px; border-radius: 0.5rem; }
.login-card .btn-row { display: flex; align-items: center; gap: 0.5rem; }
.login-card .btn-row .btn { flex: 1 0 0; }
.login-card #login-error { margin-top: 0.25rem; }
/* Custom button styles */
.custom-primary-btn {
    background-color: #00a2c5;
    color: #fff;
    border: 1px solid #00a2c5;
    border-radius: 0.375rem;
}
.custom-primary-btn:hover {
    background-color: #0094b6;
    border-color: #0094b6;
    color: #fff;
}
.custom-primary-btn:focus {
    outline: none;
    box-shadow: 0 0 0 .125rem rgba(0, 162, 197, .25);
}
.custom-primary-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}
/* Hero brand title */
#hero-brand-title {
    font-size: 40px; /* larger */
    font-weight: 600;
    background-image: linear-gradient(90deg, #14ADE0 0%, #14F792 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

/* Slight nudge upward relative to hero content block */
.hero-overlay .hero-content {
    transform: translateY(-30px);
    height: 200px;
}

/* Login brand title (smaller to fit card) */
#login-brand-title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.1;
    background-image: linear-gradient(90deg, #14ADE0 0%, #14F792 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Keep Orbit word in gradient, color AI #00a2c5 in hero/login when non-embed */
html.embed-false #hero-brand-title .brand-orbit .orbit-word,
html.embed-false #login-brand-title .brand-orbit .orbit-word {
    background-image: linear-gradient(90deg, #14ADE0 0%, #14F792 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
html.embed-false #hero-brand-title .brand-orbit .orbit-ai,
html.embed-false #login-brand-title .brand-orbit .orbit-ai {
    color: #0d9dfd;
    -webkit-background-clip: initial;
    background-clip: initial;
    font-weight: lighter;
}

/* For Cropin brand (embed=true): keep Cropin in gradient, color "Sage 2.0" as #00a2c5 */
html.embed-true #hero-brand-title .brand-cropin .cropin-word,
html.embed-true #login-brand-title .brand-cropin .cropin-word {
    background-image: linear-gradient(90deg, #14ADE0 0%, #14F792 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
html.embed-true #hero-brand-title .brand-cropin .cropin-sage,
html.embed-true #login-brand-title .brand-cropin .cropin-sage {
    color: #0d9dfd;
    -webkit-background-clip: initial;
    background-clip: initial;
    font-size: 30px;
}

/* Delete modal (mirrors rename modal) */
.delete-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* Improve separation from background */
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.delete-modal-overlay.open { display: flex; }
.delete-modal-dialog {
    /* Subtle boundary in light mode */
    border: 1px solid var(--color-border);
    background: #fff;
    width: min(92vw, 420px);
    border-radius: 0.5rem;
    padding: 0.75rem 0.75rem 0.75rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* ==========================
     UI Makeover: Chat Enhancements
     ========================== */
.bot-message-bubble:hover,
.user-message-bubble:hover {
    transform: none !important;
    box-shadow: var(--shadow-sm);
}

/* 2) Sessions list spacing between items */
.sessions-overlay .overlay-list .list-group-item {
    margin: 2px 0;
}

/* 3) Ensure session action menu renders above neighbors */
.list-group-item .session-actions .session-menu {
    z-index: 1002; /* above list items and sticky header */
}
/* Elevate stacking when the actions menu is open */
.list-group-item .session-actions.open {
    position: relative;
    z-index: 1003;
}

/* 3b) Prevent hovered items from creating a higher stacking context than open menus */
.sessions-overlay .list-group-item {
    position: relative; /* enable z-index stacking */
}
/* Remove transform on hover to avoid new stacking contexts overshadowing menus */
.sessions-overlay .list-group-item:not(.active):hover {
    transform: none !important;
}

/* 4) Add breathing room between overlay header and list */
.sessions-overlay .overlay-header {
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(2,6,23,0.06);
}
.sessions-overlay .overlay-list {
    margin-top: 0.25rem;
}

/* ==========================
     UI Makeover: Modern Theme
     (CSS-only visual revamp)
     Palette per project:
     - Primary: #00a2c5
     - Secondary: #22ae56
     - Tertiary: #d63384
     - Quaternary: #0d6efd
     ========================== */

:root {
    --color-primary: #00a2c5;
    --color-secondary: #22ae56;
    --color-tertiary: #d63384;
    --color-quaternary: #0d6efd;
    --color-bg: #f8f9fa;
    --color-card: #ffffff;
    --color-muted: #64748b;
    --color-border: rgba(2, 6, 23, 0.08);
    --shadow-sm: 0 4px 10px rgba(2, 6, 23, 0.06);
    --shadow-md: 0 10px 25px rgba(2, 6, 23, 0.12);
    --shadow-lg: 0 18px 40px rgba(2, 6, 23, 0.18);
    --radius-sm: .375rem;
    --radius-md: .75rem;
    --radius-lg: 1.25rem;
    --radius-pill: 999px;
}

/* Global background with subtle radial washes */
body {
    background:
        radial-gradient(1200px 800px at 10% -10%, rgba(13,110,253,0.06), transparent 60%),
        radial-gradient(1000px 600px at 110% 10%, rgba(0,162,197,0.08), transparent 60%),
        var(--color-bg);
    color: #0f172a;
}

/* Chat card: soft glassy panel */
#chat-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.94));
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    backdrop-filter: saturate(1.05) blur(8px);
}

/* Hero overlay: gentle entrance */
#chat-card.hero-active .hero-overlay {
    animation: fadeSlideIn 260ms ease both;
}

/* Input dock: floating, airy */
.input-box {
    box-shadow: 0 -6px 18px 0px #00000014;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.96));
    border: 1px solid var(--color-border);
}

/* Inputs: crisp borders + responsive focus ring */
.form-control.user-input,
.hero-input-group .form-control.user-input {
    border: 1px solid rgba(2,6,23,0.06);
    transition: box-shadow 160ms ease, border-color 160ms ease, height 160ms ease, background-color 160ms ease;
}
.hero-input-group .form-control.user-input { background: #eef2f6; }
.hero-input-group .form-control.user-input:focus { background: #fff !important; }
.form-control:focus {
    box-shadow: 0 0 0 .16rem rgba(13, 110, 253, .20) !important;
    border-color: rgba(13,110,253,.35) !important;
}

/* Fancy brand gradients with a slow shimmer */
#hero-brand-title,
#login-brand-title {
    background-size: 200% auto;
    animation: gradientShift 8s ease infinite;
}

/* Message bubbles: depth + micro-interactions */
/* .bot-message-bubble,
.user-message-bubble { transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease; }
.bot-message-bubble { box-shadow: 0 2px 8px rgba(2,6,23,0.06); }
.user-message-bubble { box-shadow: 0 2px 10px rgba(0,162,197,0.22); }
.bot-message-bubble:hover,
.user-message-bubble:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); } */

/* Chat message mount animation */
.chat-message { animation: messageIn 260ms ease both; }

/* Hover controls polish */
.copy-code-btn { transition: background-color 0.2s, transform 120ms ease; }
.copy-code-btn:hover { transform: translateY(-1px); }
.chat-message .message-copy-btn { transition: opacity 120ms ease, transform 120ms ease; }
.chat-message .message-copy-btn:hover { transform: translateY(-1px) scale(1.02); }

/* Scrollbar: subtle gradient */
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1, #94a3b8);
}

/* Map/image controls */
.fullscreen-btn { transition: transform 140ms ease, box-shadow 180ms ease, background-color 180ms ease; }
.fullscreen-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.fullscreen-btn:active { transform: translateY(0); }

/* Session drawer: smoother slide and glass effect */
.sessions-overlay {
    transition: transform 320ms cubic-bezier(.2,.8,.2,1);
    box-shadow: 2px 0 18px rgba(0,0,0,0.08);
    backdrop-filter: blur(8px) saturate(1.02);
}
.sessions-overlay .list-group-item {
    border-radius: .5rem;
    transition: background-color 160ms ease, transform 120ms ease, box-shadow 160ms ease;
}
.sessions-overlay .list-group-item:not(.active):hover {
    background-color: rgba(2,6,23,0.035);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(2,6,23,0.06);
}
.list-group-item .session-actions .kebab-btn { transition: opacity 120ms ease, background-color 120ms ease, color 120ms ease, transform 120ms ease; }
.list-group-item .session-actions .kebab-btn:active { transform: scale(0.98); }
.list-group-item .session-actions .session-menu { animation: scaleIn 160ms ease both; }

/* Modals and cards: scale-in */
.rename-modal-dialog,
.delete-modal-dialog,
.login-card { animation: scaleIn 200ms ease both; }

/* Success/error toasts */
.popup-notification {
    top: 12px;
    background: linear-gradient(90deg, var(--color-secondary), #16c172);
    box-shadow: var(--shadow-md);
    transition: opacity 300ms ease, transform 300ms ease;
    transform-origin: top center;
}
.popup-notification.error { background: linear-gradient(90deg, #dc3545, #ef476f); }

/* Keyframes */
@keyframes messageIn { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: translateY(0);} }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.98);} to { opacity: 1; transform: scale(1);} }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: translateY(0);} }
@keyframes gradientShift { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ==========================
     Dark Mode Toggle + Theme
     ========================== */
.theme-toggle-btn {
    color: #334155;
    border-radius: 999px;
    border: 1px solid rgba(2,6,23,0.08);
    background: #fff;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    box-shadow: 0 2px 8px rgba(2,6,23,0.08);
}
.theme-toggle-btn:hover { background: #f8fafc; }
.theme-toggle-btn .icon-sun { display: none; }
.theme-toggle-btn.is-dark .icon-moon { display: none; }
.theme-toggle-btn.is-dark .icon-sun { display: inline-flex; }

/* Light (default) variables already set above; Dark overrides below */
html[data-theme='dark'] {
    --color-bg: #0b1220;
    --color-card: #0f172a;
    --color-muted: #9aa4b2;
    --color-border: rgba(148,163,184,0.18);
    color-scheme: dark;
}

/* Theme reveal animation (directional, performant) */
:root { view-transition-name: root; }
@media (prefers-reduced-motion: no-preference) {
    /* Simple, smooth circular reveal only */
    html.theme-animating::view-transition-old(root) { animation: none; }
        html.theme-animating::view-transition-new(root) {
        will-change: clip-path;
        contain: paint;
            animation: theme-reveal 360ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
        clip-path: circle(0 at var(--vt-x, 100%) var(--vt-y, 0%));
    }
    @keyframes theme-reveal {
        to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 100%) var(--vt-y, 0%)); }
    }
}

/* Page background */
html[data-theme='dark'] body {
    background:
        radial-gradient(1200px 800px at 10% -10%, rgba(13,110,253,0.12), transparent 60%),
        radial-gradient(1000px 600px at 110% 10%, rgba(0,162,197,0.14), transparent 60%),
        var(--color-bg);
    color: #e5e7eb;
}

/* Chat card */
html[data-theme='dark'] #chat-card {
    background: linear-gradient(180deg, rgba(15,23,42,0.78), rgba(15,23,42,0.86));
    border-color: var(--color-border);
    box-shadow: 0 10px 30px rgba(2,6,23,0.5);
    backdrop-filter: saturate(1.05) blur(8px);
}

/* Header tweaks */
html[data-theme='dark'] .card-header { border-color: var(--color-border) !important; background: rgba(15,23,42,0.6); }
html[data-theme='dark'] .powered-by { color: var(--color-muted) !important; }
html[data-theme='dark'] .theme-toggle-btn { background: #0b1220; color: #cbd5e1; border-color: var(--color-border); box-shadow: 0 2px 10px rgba(2,6,23,0.6); }
html[data-theme='dark'] .theme-toggle-btn:hover { background: #0f172a; }

/* Input dock */
html[data-theme='dark'] .input-box {
    background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(15,23,42,0.88));
    border-color: var(--color-border) !important;
    box-shadow: 0 -6px 18px rgba(2,6,23,0.6);
}
html[data-theme='dark'] .form-control.user-input,
html[data-theme='dark'] .hero-input-group .form-control.user-input {
    background: rgba(30,41,59,0.6);
    color: #e5e7eb;
    border-color: var(--color-border);
}
html[data-theme='dark'] .form-control.user-input::placeholder,
html[data-theme='dark'] .hero-input-group .form-control.user-input::placeholder { color: #94a3b8; }
html[data-theme='dark'] .form-control:focus { box-shadow: 0 0 0 .16rem rgba(13,110,253,.28) !important; border-color: rgba(13,110,253,.45) !important; }
html[data-theme='dark'] .stop-btn { filter: invert(0.8) }

/* Messages */
html[data-theme='dark'] .bot-message-bubble { background-color: #111827; color: #e5e7eb; box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
html[data-theme='dark'] .user-message-bubble { background-color: var(--color-primary); color: #fff;}
html[data-theme='dark'] .bot-message-bubble pre { background-color: #0b1220; color: #e5e7eb; }
html[data-theme='dark'] .bot-message-bubble code { background-color: #111827; color: var(--color-tertiary); }
html[data-theme='dark'] .bot-message-bubble a { color: var(--color-quaternary); }

/* Scrollbar */
html[data-theme='dark'] ::-webkit-scrollbar-track { background: #0b1220; }
html[data-theme='dark'] ::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #334155, #475569); }

/* Sessions overlay */
html[data-theme='dark'] .sessions-overlay { background: rgba(15,23,42,0.98); border-color: var(--color-border); box-shadow: 2px 0 18px rgba(0,0,0,0.5); }
html[data-theme='dark'] .sessions-overlay .overlay-header { background: rgba(15,23,42,0.98); box-shadow: 0 4px 10px rgba(0,0,0,0.35); }
html[data-theme='dark'] .sessions-overlay .list-group-item:not(.active):hover { background-color: rgba(255,255,255,0.03); }
html[data-theme='dark'] .list-group-item .session-actions .kebab-btn { color: #bdcee6; }
html[data-theme='dark'] .list-group-item .session-actions .kebab-btn:hover { background: rgba(255,255,255,0.06); color: #e5e7eb; }
html[data-theme='dark'] .list-group-item .session-actions .session-menu { background: #0f172a; border-color: var(--color-border); box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
html[data-theme='dark'] .list-group-item .session-actions .session-menu-item { color: #e5e7eb; }
html[data-theme='dark'] .list-group-item .session-actions .session-menu-item:hover { background: rgba(255,255,255,0.06); }
html[data-theme='dark'] .list-group-item .session-actions .session-menu-item.text-danger { color: #f87171; }
html[data-theme='dark'] .list-group-item .session-actions .session-menu-item.text-danger:hover { background: rgba(248,113,113,0.08); }

/* Modals */
html[data-theme='dark'] .rename-modal-dialog,
html[data-theme='dark'] .delete-modal-dialog,
html[data-theme='dark'] .login-card {
    background: #0f172a;
    border-color: var(--color-border);
    box-shadow: 0 18px 40px rgba(0,0,0,0.6);
}
html[data-theme='dark'] .login-card h5, html[data-theme='dark'] .login-card .card-title { color: var(--color-quaternary); }
html[data-theme='dark'] .login-card .form-control { background-color: #0b1220; border-color: var(--color-border); color: #e5e7eb; }
html[data-theme='dark'] .login-card .form-control::placeholder { color: #94a3b8; }
html[data-theme='dark'] .login-card .form-control:focus { border-color: rgba(13,110,253,.45); box-shadow: 0 0 0 .2rem rgba(13,110,253,.28) !important; }
html[data-theme='dark'] .login-card #login-submit, html[data-theme='dark'] .login-card .btn-primary { background-color: var(--color-primary); border-color: var(--color-primary); color: #fff; box-shadow: 0 6px 20px rgba(0,162,197,0.35); }
html[data-theme='dark'] .custom-primary-btn { background-color: var(--color-primary); border-color: var(--color-primary); color: #fff; }
html[data-theme='dark'] #login-error { color: var(--color-tertiary); }
/* Dark overlay clarity */
html[data-theme='dark'] .rename-modal-overlay,
html[data-theme='dark'] .delete-modal-overlay {
    background: rgba(2,6,23,0.6);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* Toasts */
html[data-theme='dark'] .popup-notification { box-shadow: 0 10px 24px rgba(0,0,0,0.6); }

/* Dark mode shimmer for thinking state */
html[data-theme='dark'] .shimmer-background {
    background: linear-gradient(to right, #0e1726 0%, #152036 20%, #0e1726 40%, #0e1726 100%);
    background-size: 200% 100%;
}
html[data-theme='dark'] .shimmer-background .text-muted.fst-italic {
    color: #cbd5e1 !important; /* brighter placeholder for dark mode */
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ==========================
     Dark Mode – Readability Fixes
     ========================== */
/* Hero overlay text */
html[data-theme='dark'] .hero-title { color: #cbd5e1; }
html[data-theme='dark'] .hero-overlay .hero-content { color: #e5e7eb; }

/* Textarea focus background should not turn white in dark */
html[data-theme='dark'] .form-control.user-input:focus,
html[data-theme='dark'] .hero-input-group .form-control.user-input:focus {
    background: rgba(30,41,59,0.75) !important; /* slate-800 with alpha */
    color: #e5e7eb;
}

/* Bot message bubble contrast and separation */
html[data-theme='dark'] .bot-message-bubble {
    background-color: #0e1726; /* slightly darker than card for clear separation */
    border: 1px solid rgba(148,163,184,0.12);
}
html[data-theme='dark'] .user-message-bubble {
    border: 1px solid rgba(0,0,0,0.12);
}

/* Card header text and controls */
html[data-theme='dark'] .card-header { color: #e5e7eb; }
html[data-theme='dark'] .card-header .text-secondary { color: #cbd5e1 !important; }
html[data-theme='dark'] .card-header .btn-link { color: #cbd5e1; }
html[data-theme='dark'] .card-header .btn-link:hover { color: #ffffff; }

/* Sessions overlay text colors */
html[data-theme='dark'] .sessions-overlay { color: #e5e7eb; }
html[data-theme='dark'] .sessions-overlay .overlay-header h6 { color: #e5e7eb; }
html[data-theme='dark'] .sessions-overlay .list-group-item { color: #e5e7eb; background: transparent; }
html[data-theme='dark'] .sessions-overlay .list-group-item .text-muted { color: #9aa4b2 !important; }
html[data-theme='dark'] .sessions-overlay .list-group-item.active { color: #ffffff; }
html[data-theme='dark'] .sessions-overlay .list-group-item.active .text-muted { color: rgba(255,255,255,0.9) !important; }
html[data-theme='dark'] .sessions-overlay .list-group-item:not(.active):hover { background-color: rgba(255,255,255,0.05); }

/* ==========================
     Dark Mode – Additional Fixes
     ========================== */
/* 1) Session list items borders and backgrounds */
html[data-theme='dark'] .sessions-overlay .list-group-item {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(148,163,184,0.14);
}
html[data-theme='dark'] .sessions-overlay .list-group-item.active {
    border-color: transparent !important;
    background: linear-gradient(180deg, rgba(0,162,197,0.95), rgba(0,138,167,0.98));
    color: #ffffff;
}
html[data-theme='dark'] .sessions-overlay .list-group-item:not(.active):hover {
    background-color: rgba(255,255,255,0.06) !important;
    border-color: rgba(148,163,184,0.2);
}

/* 2) Bot bubble higher contrast vs. background */
html[data-theme='dark'] .bot-message-bubble {
    background-color: #1f2937; /* gray-800 */
    border-color: rgba(148,163,184,0.16);
}

/* 3) Rename input should not be white */
html[data-theme='dark'] .rename-modal-dialog .form-control {
    background-color: #0b1220;
    color: #e5e7eb;
    border: 1px solid var(--color-border);
}
html[data-theme='dark'] .rename-modal-dialog .form-control::placeholder { color: #94a3b8; }

/* 4) Delete overlay bottom text visibility */
html[data-theme='dark'] .delete-modal-dialog { color: #e5e7eb; }
html[data-theme='dark'] .delete-modal-dialog .text-muted { color: #9aa4b2 !important; }

/* 5) Close buttons outline removal and visibility */
#close-sessions-overlay:focus, #rename-close:focus, #delete-close:focus { outline: none !important; box-shadow: none !important; }
html[data-theme='dark'] #close-sessions-overlay,
html[data-theme='dark'] #rename-close,
html[data-theme='dark'] #delete-close {
    color: #cbd5e1;
    border-color: var(--color-border);
    background: transparent;
}
html[data-theme='dark'] #close-sessions-overlay:hover,
html[data-theme='dark'] #rename-close:hover,
html[data-theme='dark'] #delete-close:hover { background: rgba(255,255,255,0.06); }

/* 6) Session list (history) button icon visibility */
html[data-theme='dark'] #history-btn img { filter: invert(1); }

/* 7) User message bubble refinement for dark mode */
html[data-theme='dark'] .user-message-bubble {
    background: linear-gradient(180deg, #0796ad, #007c94);
    color: #f8fafc;
    border-color: rgba(255,255,255,0.08);
}
html[data-theme='dark'] .user-message-bubble p,
html[data-theme='dark'] .user-message-bubble a { color: #f8fafc; }
html[data-theme='dark'] .user-message-bubble a { text-decoration: underline; }