html {
  font-size: 16px;
  scroll-behavior: smooth;
}
/* html.dynamic-font-embed {
  font-size: clamp(16px, 1.05vw, 18px);
} */

body {
    font-family: "Inter", sans-serif;
    background-color: #f8f9fa;
}

.plotly-notifier {
    display: none !important;
}

.form-control {
    font-size: 0.875rem !important;
}
.fs-9 {
    font-size: 0.625rem !important;
}
.fs-10 {
    font-size: 0.625rem !important;
}
.fs-11 {
    font-size: 0.75rem !important;
}
.fs-12 {
    font-size: 0.75rem !important;
}
.fs-13 {
    font-size: 0.8rem !important;
}
.fs-14 {
    font-size: 0.875rem !important;
}

/* Table Export */
.table-export-wrapper {
    position: relative;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.table-scroll-container {
    overflow-x: auto;
    max-width: 100%;
    width: 100%;
    padding-bottom: 4px;
}
.table-scroll-container::-webkit-scrollbar {
    height: 4px;
}
.table-scroll-container::-webkit-scrollbar-track {
    background: rgba(var(--color-primary-rgb), 0.08);
    border-radius: 4px;
    margin: 0 4px;
}
.table-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb), 0.5);
    border-radius: 4px;
    transition: background 200ms ease;
}
.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-primary-rgb), 0.8);
}
html[data-theme='dark'] .table-scroll-container::-webkit-scrollbar-track {
    background: rgba(var(--color-primary-rgb), 0.1);
}
html[data-theme='dark'] .table-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(var(--color-primary-rgb), 0.5);
}
html[data-theme='dark'] .table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--color-primary-rgb), 0.8);
}
.table-scroll-container table {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    width: max-content !important;
    min-width: 100%;
}
.table-export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    margin-top: 0.25rem;
    border-radius: 0.4rem;
    border: 1px solid rgba(2,6,23,0.1);
    background: #fff;
    color: #475569;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.table-export-wrapper:hover .table-export-btn {
    opacity: 1;
}
.table-export-btn:hover {
    background: #f1f5f9;
    border-color: var(--color-primary);
    color: var(--color-primary);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,162,197,0.15);
}
.table-export-btn:active {
    transform: scale(0.95);
}
.table-export-btn.exported {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: #fff;
}
html[data-theme='dark'] .table-export-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(148,163,184,0.3);
    color: #e2e8f0;
}
html[data-theme='dark'] .table-export-btn:hover {
    background: rgba(0,162,197,0.15);
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0,162,197,0.3);
}
html[data-theme='dark'] .table-export-btn.exported {
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: #fff;
}

/* Light mode Table */
/* Light mode Table */
.bot-message-bubble table,
table {
    font-size: 0.8rem;
    width: 100%;
    border-spacing: 0;
    border-collapse: separate;
    margin-top: 0.5rem;
    margin-bottom: 0.75rem;
    border: none;
    border-radius: 0.5rem;
    overflow: hidden;
}
table thead {
    background: rgba(var(--color-primary-rgb), 0.75);
}
table th {
    font-weight: 600;
    color: #fff;
    padding: 0.55rem 0.75rem;
    text-align: left;
    vertical-align: middle;
    border: none;
}
table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: middle;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
table tbody tr:last-child td {
    border-bottom: none;
}
table tbody tr:nth-child(odd) {
    background: #fff;
}
table tbody tr:nth-child(even) {
    background: #f8fafc;
}
table tbody tr:hover {
    background: rgba(0,162,197,0.05);
}
/* Dark mode Table */
html[data-theme='dark'] table {
    border-color: #334155;
}
html[data-theme='dark'] table thead {
    background: rgba(var(--color-primary-rgb), 0.75);
}
html[data-theme='dark'] table th {
    color: #fff;
}
html[data-theme='dark'] table td {
    color: #e2e8f0;
    border-bottom-color: #1e293b;
}
html[data-theme='dark'] table tbody tr:nth-child(odd) {
    background: #0f172a;
}
html[data-theme='dark'] table tbody tr:nth-child(even) {
    background: #1e293b;
}
html[data-theme='dark'] table tbody tr:hover {
    background: rgba(0,162,197,0.12);
}
#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;
    }
    .hero-categories {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .hero-category-btn {
        font-size: 0.8rem;
        padding: 0.6rem 0.85rem;
    }
    .hero-input-group .form-control.user-input {
        font-size: clamp(0.72rem, 2.8vw, 0.9rem);
    }
    .hero-input-group .form-control.user-input::placeholder {
        font-size: clamp(0.72rem, 2.2vw, 0.9rem);
        color: #94a3b8;
    }
}
@media screen and (min-width: 1024px) {
    #chat-container {
        padding-inline: 10vw !important;
    }
    .input-box {
        margin-inline: 10vw !important;
    }
}

#chat-container {
    flex-grow: 1;
    scroll-behavior: smooth;
    padding-bottom: 1rem;
}
#hero-input {
    max-height: 120px;
    overflow-y: auto !important;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    line-height: 1.4;
}
/* Hero overlay - initial screen */
.hero-overlay {
    position: absolute;
    inset: 56px 0 0 0; /* leave header space */
    display: flex;
    align-items: safe center;
    justify-content: center;
    overflow-y: auto;
    pointer-events: none;
    opacity: 0;
    transition: opacity 220ms ease;
    z-index: 10;
}
.hero-overlay .hero-content { pointer-events: none; }
#chat-card.hero-active .hero-overlay {
    opacity: 1;
    pointer-events: auto;
}
#chat-card.hero-active .hero-overlay .hero-content {
    pointer-events: auto;
}
.hero-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: 680px;
    width: 100%;
    padding-bottom: 2rem;
}
/* Hero icon with glow */
.hero-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
}
.hero-icon-glow {
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    box-shadow: 0 0 8px 2px rgba(0,162,197,0.35);
    animation: pulseGlow 3s ease-in-out infinite;
}
@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.85; }
    50% { transform: scale(1.15); opacity: 1; }
}
.hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}
/* Hero heading */
.hero-heading {
    font-size: clamp(20px, 2.5vw, 26px);
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    margin-top: -0.75rem;
}
/* Hero description */
.hero-description {
    font-size: clamp(13px, 1.4vw, 15px);
    color: #64748b;
    max-width: 420px;
    line-height: 1.5;
}
/* Hero input wrapper - no longer absolute */
.hero-input-wrapper {
    width: min(600px, 92vw);
    display: flex;
    flex-direction: column;
}
.hero-input-group {
    width: 100%;
    align-items: flex-end;
    background: #ffffff;
    border-radius: 2rem;
    border: 1px solid rgba(2,6,23,0.1);
    padding: 0.25rem;
    box-shadow: 0 2px 8px rgba(2,6,23,0.04);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.hero-input-group:focus-within {
    border-color: rgba(0,162,197,0.4);
    box-shadow: 0 2px 12px rgba(0,162,197,0.1);
    background: #fff;
}
/* Hero categories grid */
.hero-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1.25rem;
    width: min(600px, 92vw);
}
.hero-category-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid rgba(2,6,23,0.08);
    border-radius: 0.75rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: #334155;
    transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
    text-align: left;
}
.hero-category-btn:hover {
    background: #f8fafc;
    border-color: rgba(0,162,197,0.3);
    box-shadow: 0 2px 8px rgba(0,162,197,0.08);
    transform: translateY(-1px);
}
.hero-category-btn:active {
    transform: translateY(0);
}
.hero-category-btn .category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.5rem;
    background: rgba(0,162,197,0.08);
    color: var(--color-primary);
    flex-shrink: 0;
}
html.embed-false #hero-brand-title .brand-orbit { display: inline; }
.hero-input-group .form-control.user-input {
    background: transparent;
    border-radius: 1.5rem !important;
    resize: none; /* auto-resize via JS */
    overflow-y: auto;
    scrollbar-gutter: stable both-edges; /* keep scrollbar space inside */
    background-clip: padding-box;
    border: none !important;
    box-shadow: none !important;
}
.hero-input-group .form-control.user-input::placeholder {
    color: #94a3b8;
}
.hero-input-group .form-control.user-input:focus {
    background: transparent !important;
    box-shadow: none !important;
}
.hero-input-group .btn {
    border-radius: 50%;
    background: transparent;
    border: none;
}
.input-box {
    border-radius: 1.5rem;
    margin: 0rem 1rem 0.25rem 1rem;
    box-shadow: 0 -4px 8px 0px #0000000d;
}
.input-tip {
    text-align: center;
    font-size: 0.7rem;
    color: #94a3b8;
    padding: 0 1rem;
    line-height: 1.3;
}
html[data-theme='dark'] .input-tip {
    color: #64748b;
}
#chat-card.hero-active .input-tip {
    display: none;
}
.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; }
/* Hide header border on welcome/hero screen */
#chat-card.hero-active .card-header {
    border-bottom-color: transparent !important;
    box-shadow: none;
}

/* Theme toggle visible in embed=false mode */
html.embed-false #theme-toggle-container {
    display: flex !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;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.powered-by {
    position: absolute;
    bottom: -16px;
    left: 0;
    white-space: nowrap;
}
.brand-logo { height: 24px; vertical-align: middle; }
.big-logo { height: 40px; }
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: 4px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

.map-container .leaflet-control-attribution {
    font-size: 0.625rem;
    background: rgba(255,255,255,0.72);
}

html[data-theme='dark'] .map-container .leaflet-control-attribution {
    background: rgba(15,23,42,0.72);
    color: #cbd5e1;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

#new-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.35rem 0.75rem;
    border-radius: 2rem;
    border: 1px solid rgba(2,6,23,0.15);
    color: #334155;
    background: #fff;
    transition: all 160ms ease;
    text-decoration: none !important;
}
#new-chat-btn:hover {
    background: #f8fafc;
    border-color: rgba(2,6,23,0.25);
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(2,6,23,0.08);
}
/* Hide new session button when on welcome/hero screen */
#chat-card.hero-active #new-chat-btn {
    display: none !important;
}
#chat-card.hero-active #new-chat-btn-2 {
    display: none !important;
}
html[data-theme='dark'] #new-chat-btn {
    border-color: rgba(148,163,184,0.2);
    background: rgba(255,255,255,0.04);
    color: #cbd5e1;
}
html[data-theme='dark'] #new-chat-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(148,163,184,0.35);
    color: #e5e7eb;
}
#logout-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #64748b;
    padding: 0.3rem 0.5rem;
    border-radius: 0.5rem;
    transition: color 160ms ease, background 160ms ease;
}
#logout-btn:hover {
    color: #334155;
    background: rgba(2,6,23,0.04);
}
#logout-btn img {
    width: 16px;
    height: 16px;
}
html[data-theme='dark'] #logout-btn {
    color: #94a3b8;
}
html[data-theme='dark'] #logout-btn:hover {
    color: #e5e7eb;
    background: rgba(255,255,255,0.05);
}


.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: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.user-avatar {
    background-color: #63c5e5;
    color: #fff;
    margin-bottom: 4px;
}

.bot-message-bubble {
    background-color: #f8fafc;
    border: 1px solid transparent;
    border-radius: 1rem;
    border-top-left-radius: 0.25rem;
    max-width: 85%;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(2,6,23,0.04);
    background-image: linear-gradient(#f8fafc, #f8fafc), linear-gradient(135deg, rgba(0,162,197,0.3), rgba(34,174,86,0.3), rgba(13,110,253,0.3));
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.user-message-bubble {
    background: linear-gradient(135deg, #00b4d8 0%, #00a2c5 40%, #0090b0 100%);
    color: white;
    border-radius: 1.25rem;
    border-bottom-right-radius: 0.3rem;
    max-width: 85%;
    box-shadow: 0 4px 14px rgba(0,162,197,0.25), 0 1px 3px rgba(0,0,0,0.08);
}

/* Location chip inside user message bubble */
.user-location-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255,255,255,0.22);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 999px;
    padding: 0.2rem 0.65rem 0.2rem 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
    letter-spacing: 0.01em;
}
.user-location-chip-icon {
    font-size: 0.8rem;
    line-height: 1;
}
html[data-theme='dark'] .user-location-chip {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.28);
}

/* When a chart is present, force the bot bubble to use full available width */
.bot-message-bubble:has(.chart-wrapper) {
    width: 85%;
}

.chart-wrapper {
    min-width: 300px;
    width: 100%;
}

.bot-message-bubble>*:last-child,
.user-message-bubble>*:last-child {
    margin-bottom: 0;
}

.bot-message-bubble p,
.user-message-bubble p {
    margin: 0;
}

/* Soften headings inside bot messages */
.bot-message-bubble h1,
.bot-message-bubble h2,
.bot-message-bubble h3,
.bot-message-bubble h4,
.bot-message-bubble h5,
.bot-message-bubble h6 {
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}
.bot-message-bubble h1 { font-size: 1.35rem; }
.bot-message-bubble h2 { font-size: 1.2rem; }
.bot-message-bubble h3 { font-size: 1.1rem; }
.bot-message-bubble h4,
.bot-message-bubble h5,
.bot-message-bubble h6 { font-size: 0.95rem; }
.bot-message-bubble h1 strong,
.bot-message-bubble h2 strong,
.bot-message-bubble h3 strong,
.bot-message-bubble h4 strong,
.bot-message-bubble h5 strong,
.bot-message-bubble h6 strong {
    font-weight: 700;
}
.bot-message-bubble strong {
    font-weight: 600;
}

/* 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 */
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: var(--color-quaternary);
    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: var(--color-tertiary);
    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: 6px; }
.chat-message {
    margin-bottom: 0.75rem;
}
.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: 50% !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 160ms ease, transform 120ms ease;
}
.send-btn:hover {
    background: rgba(0,162,197,0.1);
    transform: scale(1.05);
}
.stop-btn {
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #f1f5f9;
    border: 1px solid rgba(2,6,23,0.1);
    transition: background 160ms ease, transform 120ms ease;
    margin-left: 2px !important;
}
.stop-btn img {
    width: 18px;
    height: 18px;
}
.stop-btn:hover {
    background: #e2e8f0;
    transform: scale(1.05);
}
.stop-btn:hover img {
    opacity: 1;
}
html[data-theme='dark'] .stop-btn {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    filter: none;
}
html[data-theme='dark'] .stop-btn img {
    filter: invert(1);
}
html[data-theme='dark'] .stop-btn:hover {
    background: rgba(255,255,255,0.14);
}
.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; }


.orbitai-icon-border {
    position: relative;
    top: -10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 43px;
    height: 41px;
}
.orbitai-icon-border.emdeded {
    width: 42px;
}

.orbitai-icon-border-arc {
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    box-shadow: 0 0 6px 2px rgba(0,162,197,0.4);
    animation: orbitai-pulse-glow 1.2s ease-in-out infinite;
}
@keyframes orbitai-pulse-glow {
    0%, 100% { transform: scale(0.95); opacity: 0.6; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* Popup notification for session ID copy */
.popup-notification {
    position: fixed;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-secondary);
    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.8rem;
    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(90deg, #f0f9fc 0%, #e0f4f8 25%, #f0f9fc 50%, #e6f9ee 75%, #f0f9fc 100%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 0.5rem;
}
/* Thinking/status text styling */
.shimmer-background .status-text {
    color: #4b5563 !important;
    font-size: 0.85rem;
}

@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: #fff;
    border-right: 1px solid rgba(2,6,23,0.06);
    box-shadow: 4px 0 20px rgba(2,6,23,0.08);
    transform: translateX(-100%);
    transition: transform 280ms ease;
    z-index: 30;
}
.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: 25; /* above header (20), below overlay (30) */
}
.sessions-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
.sessions-overlay .overlay-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.5rem;
}
.sessions-overlay .overlay-header {
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.98);
    z-index: 1;
    padding: 0.5rem 0.85rem 0.4rem;
}
.sessions-search-toggle,
#close-sessions-overlay,
.sessions-overlay-btn {
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 0.5rem;
    color: #475569;
    border: 1px solid rgba(2,6,23,0.12);
    background: #fff;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.sessions-search-toggle svg,
.sessions-overlay-btn svg { width: 16px; height: 16px; }
.sessions-search-toggle:hover, .sessions-search-toggle:focus,
#close-sessions-overlay:hover, #close-sessions-overlay:focus,
.sessions-overlay-btn:hover, .sessions-overlay-btn:focus {
    background: #f1f5f9;
    border-color: rgba(2,6,23,0.2);
    color: #0f172a;
}
html[data-theme='dark'] .sessions-search-toggle,
html[data-theme='dark'] #close-sessions-overlay,
html[data-theme='dark'] .sessions-overlay-btn {
    color: #94a3b8;
    border-color: rgba(148,163,184,0.2);
    background: rgba(255,255,255,0.04);
}
html[data-theme='dark'] .sessions-search-toggle:hover,
html[data-theme='dark'] .sessions-search-toggle:focus,
html[data-theme='dark'] #close-sessions-overlay:hover,
html[data-theme='dark'] #close-sessions-overlay:focus,
html[data-theme='dark'] .sessions-overlay-btn:hover,
html[data-theme='dark'] .sessions-overlay-btn:focus {
    background: rgba(255,255,255,0.08);
    border-color: rgba(148,163,184,0.35);
    color: #e5e7eb;
}
.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;
    height: calc(100% - 48px);
}
.sessions-overlay .list-loading {
    padding: 0.5rem;
    overflow: unset;
}
.sessions-overlay .list-group-item {
    cursor: pointer;
    border: none;
    border-radius: 0.5rem !important;
    padding: 0.65rem 0.75rem;
    margin: 0.2rem 0.5rem;
    transition: background 150ms ease;
}
.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 {
    background-color: rgba(0,162,197,0.08);
    border: none !important;
    color: #0f172a;
    border-left: 3px solid var(--color-primary) !important;
    border-radius: 0 0.5rem 0.5rem 0 !important;
}
.sessions-overlay .list-group-item:not(.active):hover {
    background: rgba(2,6,23,0.03);
}
/* 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: var(--color-primary);
}

.list-group-item.active .session-actions .kebab-btn:hover {
    background: rgba(0,162,197,0.1);
    color: var(--color-primary);
}

.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: var(--color-primary);
    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, var(--color-primary), var(--color-quaternary), var(--color-secondary));
}
.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: var(--color-quaternary);
    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: var(--color-primary);
    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: var(--color-primary);
    border-color: var(--color-primary);
    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: var(--color-tertiary); 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: var(--color-primary);
    color: #fff;
    border: 1px solid var(--color-primary);
    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(to right, #69d9f0 0%, #6be6b3 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

/* Hero content alignment */
.hero-overlay .hero-content {
    transform: none;
    height: auto;
}

/* Login brand title (smaller to fit card) */
#login-brand-title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.1;
    background-image: linear-gradient(to right, #69d9f0 0%, #6be6b3 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(to right, #69d9f0 0%, #6be6b3 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;
}


/* 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);
}

/* Auth Token modal (mirrors rename and delete modals) */
.authtoken-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);
}
.authtoken-modal-overlay.open { display: flex; }
.authtoken-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 {
    transform: none !important;
    box-shadow: var(--shadow-sm);
}
.user-message-bubble:hover {
    transform: none !important;
    box-shadow: 0 6px 20px rgba(0,162,197,0.3), 0 2px 6px rgba(0,0,0,0.1);
}

/* 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.6rem;
    border-bottom: 1px solid rgba(2,6,23,0.06);
}
.sessions-overlay .overlay-list {
    margin-top: 0.25rem;
}

/* === Design System Variables === */
:root {
    --color-primary: #00a2c5;
    --color-primary-rgb: 0,162,197;
    /* --color-primary-new: #69d9f0; */
    --color-secondary: #22ae56;
    /* --color-secondary-new: #6be6b3; */
    --color-tertiary: #d63384;
    --color-quaternary: #0d6efd;
    /* --color-quaternary-new: #4b98ee; */

    --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);
    contain: layout style paint;
}

/* Hero overlay: gentle entrance handled by opacity transition */

/* Input dock: floating, airy */
.input-box {
    position: relative;
    overflow: visible;
    box-shadow: 0 -2px 12px 0px rgba(0,0,0,0.06);
    background: #ffffff;
    border: 1px solid rgba(2,6,23,0.08);
}

/* Inputs: crisp borders + responsive focus ring */
.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: transparent; border: none; }
.hero-input-group .form-control.user-input:focus { background: transparent !important; box-shadow: none !important; border: none !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 animations */
.chat-message.from-user {
    animation: slideUpFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-fill-mode: both;
}
.chat-message.from-user .user-message-bubble {
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-message.from-bot {
    animation: slideDownFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-fill-mode: both;
}
.chat-message.from-bot .bot-message-bubble {
    transform: translateY(0);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 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:not(.active):hover {
    transform: none;
}
.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; }

/* Active session request indicators */
.session-status { display:inline-flex; align-items:center; margin-left:6px; flex-shrink:0; }
/* Base dot — primary theme color, compact */
.session-active-dot { position:relative; display:inline-block; width:8px; height:8px; border-radius:50%; background: #00a2c5; }
/* Fetching phase: animated pulse */
.session-active-dot.fetching { background: #00a2c5; animation: pulseDotBg 1.2s ease-in-out infinite; }
/* Typing/rendering phase */
.session-active-dot.typing { background: #00a2c5; }
/* Done/unseen: subtle secondary */
.session-active-dot.done { background: #22ae56; }
/* Animated outer ring only for fetching */
.session-active-dot.fetching::after { content:""; position:absolute; inset:-4px; border-radius:50%; border:2px solid #00a2c5; animation: pulseDot 1.2s ease-in-out infinite; }
@keyframes pulseDot { 0% { transform:scale(.7); opacity:.7;} 50% { transform:scale(1.15); opacity:.1;} 100% { transform:scale(.7); opacity:.7;} }
@keyframes pulseDotBg { 0%,100% { opacity:1;} 50% { opacity:.5;} }
/* Dark mode */
[data-bs-theme="dark"] .session-active-dot { background: #00a2c5; }
[data-bs-theme="dark"] .session-active-dot.done { background: #22ae56; }

/* Session Title Dropdown */
.session-title-container {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 0.25rem;
    max-width: 50vw;
}
.session-title-dropdown-wrapper {
    position: relative;
    max-width: 100%;
}
.session-title-btn {
    border-radius: 0.5rem;
    padding: 0.35rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    color: #334155;
    font-size: 0.813rem;
    font-weight: 500;
    height: 32px;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 1px solid transparent;
    background: transparent;
}
.session-title-btn:hover {
    background: #f8fafc;
    border-color: rgba(0, 162, 197, 0.2);
    color: #1e293b;
}
.session-title-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 162, 197, 0.1);
    border-color: var(--color-primary);
}
.session-title-btn.active {
    border-color: var(--color-primary);
    background: rgba(0, 162, 197, 0.05);
}
.session-title-text {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.25rem;
    min-width: 0;
    line-height: 1.3;
}
.session-dropdown-arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #64748b;
}
.session-title-btn.active .session-dropdown-arrow {
    transform: rotate(180deg);
}
.session-options-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(-8px) scale(0.95);
    background: #fff;
    border: 1px solid rgba(2,6,23,0.08);
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(2,6,23,0.15);
    min-width: 130px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
}
.session-options-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}
.session-options-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    color: #334155;
    font-size: 0.813rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 0.5rem;
}
.session-options-dropdown .dropdown-item:hover {
    background: #f1f5f9;
    color: #1e293b;
}
.session-options-dropdown .dropdown-item svg {
    flex-shrink: 0;
    color: #64748b;
}
.session-options-dropdown .dropdown-item:hover svg {
    color: #334155;
}
#session-delete-option {
    color: #dc3545;
}
#session-delete-option svg {
    color: #dc3545;
}
#session-delete-option:hover {
    background: rgba(220,53,69,0.08);
    color: #dc3545;
}
#session-delete-option:hover svg {
    color: #dc3545;
}
/* Dark mode Session Title */
html[data-theme='dark'] .session-title-btn {
    color: #cbd5e1;
    background: transparent;
}
html[data-theme='dark'] .session-title-btn:hover {
    background: rgba(15,23,42,0.8);
    border-color: rgba(0, 162, 197, 0.3);
    color: #e5e7eb;
}
html[data-theme='dark'] .session-title-btn:focus {
    box-shadow: 0 0 0 3px rgba(0, 162, 197, 0.15);
    border-color: var(--color-primary);
}
html[data-theme='dark'] .session-title-btn.active {
    border-color: var(--color-primary);
    background: rgba(0, 162, 197, 0.1);
}
html[data-theme='dark'] .session-dropdown-arrow {
    color: #94a3b8;
}
html[data-theme='dark'] .session-options-dropdown {
    background: #1e293b;
    border-color: rgba(148,163,184,0.15);
    box-shadow: 0 10px 30px rgba(2,6,23,0.7);
}
html[data-theme='dark'] .session-options-dropdown .dropdown-item {
    color: #cbd5e1;
}
html[data-theme='dark'] .session-options-dropdown .dropdown-item:hover {
    background: rgba(30,41,59,0.6);
    color: #e5e7eb;
}
html[data-theme='dark'] .session-options-dropdown .dropdown-item svg {
    color: #94a3b8;
}
html[data-theme='dark'] .session-options-dropdown .dropdown-item:hover svg {
    color: #cbd5e1;
}
html[data-theme='dark'] #session-delete-option {
    color: #f87171;
}
html[data-theme='dark'] #session-delete-option svg {
    color: #f87171;
}
html[data-theme='dark'] #session-delete-option:hover {
    background: rgba(248,113,113,0.08);
    color: #f87171;
}
html[data-theme='dark'] #session-delete-option:hover svg {
    color: #f87171;
}

/* Interaction Blocking Overlay */
.interaction-blocking-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.interaction-blocking-overlay.active {
    display: flex;
}
.interaction-blocking-overlay .loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 32px;
    background: var(--color-card, #fff);
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
}
.interaction-blocking-overlay .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 162, 197, 0.2);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.interaction-blocking-overlay .loading-text {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
html[data-theme='dark'] .interaction-blocking-overlay {
    background: rgba(15, 23, 42, 0.7);
}
html[data-theme='dark'] .interaction-blocking-overlay .loading-content {
    background: #1e293b;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}
html[data-theme='dark'] .interaction-blocking-overlay .loading-text {
    color: #94a3b8;
}
html[data-theme='dark'] .interaction-blocking-overlay .loading-spinner {
    border-color: rgba(0, 162, 197, 0.15);
    border-top-color: var(--color-primary);
}

/* 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 slideUpFadeIn {
    0% { opacity: 0; transform: translateY(50px) translateX(50px) scale(0.75); }
    100% { opacity: 1; transform: translateY(0) translateX(0) scale(1); }
}
@keyframes slideDownFadeIn {
    0% { opacity: 0; transform: translateY(-50px) translateX(-50px) scale(0.75); }
    100% { opacity: 1; transform: translateY(0) translateX(0) scale(1); }
}
@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);
}

/* Header tweaks */
.card-header {
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid rgba(2,6,23,0.06) !important;
    padding: 0.5rem 0.75rem 0.85rem !important;
    backdrop-filter: blur(6px);
    box-shadow: 0 1px 4px rgba(2,6,23,0.06);
    overflow: visible;
    position: relative;
    z-index: 20;
}
.card-header .d-flex {
    gap: 0.6rem;
}
.new-session-btn {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    font-size: 0.875rem;
    padding: 0.2rem;
    border-radius: 0.4rem;
    border: none !important;
    box-shadow: none !important;
    outline: none;
    background: transparent;
}
#new-chat-btn {
    margin-left: -1rem;
}

/* Settings Toggle Button */
.settings-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;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(2,6,23,0.08);
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}
.settings-toggle-btn:hover {
    background: #f8fafc;
    transform: rotate(90deg);
}
.settings-toggle-btn:active {
    transform: rotate(180deg) scale(0.95);
}
.settings-toggle-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    transform: rotate(90deg);
}

/* Settings Container */
.settings-container {
    position: relative;
}

/* Settings Dropdown */
.settings-dropdown {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: -100%;
    background: #fff;
    border: 1px solid rgba(2,6,23,0.08);
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(2,6,23,0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    backdrop-filter: blur(8px);
}
.settings-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Settings Content */
.settings-content {
    padding: 0.75rem;
}
.settings-header {
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(2,6,23,0.08);
    margin-bottom: 0.75rem;
}
.settings-header h6 {
    color: #1e293b;
    font-weight: 600;
    font-size: 0.875rem;
    margin: 0;
}
.settings-body {
    min-height: 40px;
}

/* Setting Item */
.setting-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    cursor: pointer;
}
.setting-item img {
    width: 18px;
    height: 18px;
}

#history-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    margin-right: 0.5rem;
    border-radius: 0.4rem;
    border: none;
    background: transparent;
    color: #64748b;
    transition: background 150ms ease, color 150ms ease;
}
#history-btn:hover {
    background: rgba(2,6,23,0.05);
    color: #334155;
}
#history-btn img {
    width: 28px;
    height: 28px;
}
html[data-theme='dark'] #history-btn {
    color: #94a3b8;
    background: transparent;
}
html[data-theme='dark'] #history-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #e5e7eb;
}
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; }
/* Dark mode Settings */
html[data-theme='dark'] .settings-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'] .settings-toggle-btn:hover {
    background: #0f172a;
    transform: rotate(90deg);
}
html[data-theme='dark'] .settings-toggle-btn:active {
    background: #0f172a;
    transform: rotate(180deg) scale(0.95);
}
html[data-theme='dark'] .settings-toggle-btn.active {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
html[data-theme='dark'] .settings-dropdown {
    background: linear-gradient(180deg, rgba(15,23,42,0.95), rgba(15,23,42,0.98));
    border-color: var(--color-border);
    box-shadow: 0 10px 30px rgba(2,6,23,0.7);
    backdrop-filter: blur(12px);
}
html[data-theme='dark'] .settings-header {
    border-bottom-color: var(--color-border);
}
html[data-theme='dark'] .settings-header h6 {
    color: #e5e7eb;
}
html[data-theme='dark'] .setting-item {
    color: #cbd5e1;
}
html[data-theme='dark'] .setting-item img {
    filter: invert(1);
}

/* Input dock */
html[data-theme='dark'] .input-box {
    background: #1e293b;
    border-color: rgba(148,163,184,0.12) !important;
    box-shadow: none;
}
html[data-theme='dark'] .form-control.user-input,
html[data-theme='dark'] .hero-input-group .form-control.user-input {
    color: #e5e7eb;
    border-color: var(--color-border);
}
html[data-theme='dark'] .form-control.user-input {
    background: transparent;
}
html[data-theme='dark'] .hero-input-group .form-control.user-input {
    background: transparent;
    border: none;
}
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: none !important; border-color: rgba(148,163,184,0.15) !important; }

/* Messages */
html[data-theme='dark'] .bot-message-bubble { background-color: #1e293b; color: #e5e7eb; border-color: transparent; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }
html[data-theme='dark'] .user-message-bubble { background: linear-gradient(135deg, #0097b2 0%, #007c94 50%, #006577 100%); color: #fff; box-shadow: 0 4px 16px rgba(0,162,197,0.3), 0 1px 4px rgba(0,0,0,0.3); }
html[data-theme='dark'] .bot-message-bubble pre { background-color: #0f172a; color: #e5e7eb; }
html[data-theme='dark'] .bot-message-bubble code { background-color: #0f172a; 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: #0f172a; border-color: var(--color-border); box-shadow: 4px 0 20px rgba(0,0,0,0.4); }
html[data-theme='dark'] .sessions-overlay .overlay-header { background: #0f172a; box-shadow: 0 1px 0 rgba(148,163,184,0.1); }
html[data-theme='dark'] .sessions-overlay .list-group-item:not(.active):hover { background-color: rgba(255,255,255,0.04); }
html[data-theme='dark'] .sessions-overlay .list-group-item.active { background-color: rgba(0,162,197,0.12); color: #e5e7eb; border-left-color: var(--color-primary) !important; }
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'] .authtoken-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,
html[data-theme='dark'] .authtoken-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'] .bot-message-bubble.shimmer-background {
    background-color: transparent !important;
    background-image: linear-gradient(90deg, #1e293b 0%, #1a3a4a 25%, #1e293b 50%, #1a3a4a 75%, #1e293b 100%) !important;
    background-size: 200% 100% !important;
    background-origin: padding-box !important;
    background-clip: padding-box !important;
    border-color: rgba(0,162,197,0.2) !important;
    animation: shimmer 2s infinite linear !important;
}
html[data-theme='dark'] .shimmer-background .status-text {
    color: #c8dce4 !important;
}

/* ==========================
     Dark Mode – Readability Fixes
     ========================== */
/* Hero overlay text */
html[data-theme='dark'] .hero-title { color: #cbd5e1; }
html[data-theme='dark'] .hero-heading { color: #e5e7eb; }
html[data-theme='dark'] .hero-description { color: #94a3b8; }
html[data-theme='dark'] .hero-overlay .hero-content { color: #e5e7eb; }
html[data-theme='dark'] .hero-input-group {
    background: rgba(30,41,59,0.6);
    border-color: var(--color-border);
}
html[data-theme='dark'] .hero-input-group:focus-within {
    background: rgba(30,41,59,0.85);
    border-color: rgba(0,162,197,0.45);
}
html[data-theme='dark'] .hero-category-btn {
    background: rgba(30,41,59,0.5);
    border-color: rgba(148,163,184,0.14);
    color: #cbd5e1;
}
html[data-theme='dark'] .hero-category-btn:hover {
    background: rgba(30,41,59,0.75);
    border-color: rgba(0,162,197,0.35);
}
html[data-theme='dark'] .hero-category-btn .category-icon {
    background: rgba(0,162,197,0.12);
    color: #69d9f0;
}
html[data-theme='dark'] .hero-icon-glow {
    box-shadow: 0 0 10px 3px rgba(0,162,197,0.5);
}
html[data-theme='dark'] .orbitai-icon-border-arc {
    box-shadow: 0 0 10px 3px rgba(0,162,197,0.6);
}

/* Textarea focus background should not turn white in dark */
html[data-theme='dark'] .form-control.user-input:focus {
    background: rgba(30,41,59,0.75) !important; /* slate-800 with alpha */
    color: #e5e7eb;
}
html[data-theme='dark'] .hero-input-group .form-control.user-input:focus {
    background: transparent !important;
    color: #e5e7eb;
}

/* Bot message bubble contrast and separation */
html[data-theme='dark'] .bot-message-bubble {
    background-color: #0e1726;
    border: 1px solid transparent;
    background-image: linear-gradient(#0e1726, #0e1726), linear-gradient(135deg, rgba(0,162,197,0.35), rgba(34,174,86,0.35), rgba(13,110,253,0.35));
    background-origin: border-box;
    background-clip: padding-box, border-box;
}
html[data-theme='dark'] .user-message-bubble {
    border: 1px solid rgba(255,255,255,0.1);
}

/* 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
     ========================== */
/* Session list items borders and backgrounds */
html[data-theme='dark'] .sessions-overlay .list-group-item {
    background: transparent;
    border: none;
}
html[data-theme='dark'] .sessions-overlay .list-group-item.active {
    border-color: transparent !important;
    background: rgba(0,162,197,0.12);
    color: #e5e7eb;
    border-left: 3px solid var(--color-primary) !important;
}
html[data-theme='dark'] .sessions-overlay .list-group-item:not(.active):hover {
    background-color: rgba(255,255,255,0.04) !important;
}

/* Bot bubble higher contrast vs. background */
html[data-theme='dark'] .bot-message-bubble {
    background-color: #1f2937;
    background-image: linear-gradient(#1f2937, #1f2937), linear-gradient(135deg, rgba(0,162,197,0.35), rgba(34,174,86,0.35), rgba(13,110,253,0.35));
    background-origin: border-box;
    background-clip: padding-box, border-box;
    border-color: transparent;
}

/* Rename input should not be white */
html[data-theme='dark'] .rename-modal-dialog .form-control,
html[data-theme='dark'] .authtoken-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,
html[data-theme='dark'] .authtoken-modal-dialog .form-control::placeholder { 
    color: #94a3b8; 
}

/* Delete overlay bottom text visibility */
html[data-theme='dark'] .delete-modal-dialog,
html[data-theme='dark'] .authtoken-modal-dialog { 
    color: #e5e7eb; 
}
html[data-theme='dark'] .delete-modal-dialog .text-muted,
html[data-theme='dark'] .authtoken-modal-dialog .text-muted { 
    color: #9aa4b2 !important; 
}

/* 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); }

/* Session list (history) button icon visibility */
html[data-theme='dark'] #history-btn img { filter: invert(1); }

/* User message bubble refinement for dark mode */
html[data-theme='dark'] .user-message-bubble {
    background: linear-gradient(135deg, #0097b2 0%, #007c94 50%, #006577 100%);
    color: #f8fafc;
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 4px 16px rgba(0,162,197,0.3), 0 1px 4px rgba(0,0,0,0.3);
}
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; }
/* ==========================
     Map Widget – Plus Button & Menu
     ========================== */
.input-plus-wrapper {
    display: inline-flex;
    align-items: center;
}
.plus-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50% !important;
    background: transparent;
    color: var(--color-primary);
    border: 1px solid transparent;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
    flex-shrink: 0;
}
.plus-btn:hover {
    background: rgba(0,162,197,0.10);
    border-color: rgba(0,162,197,0.18);
}
.plus-btn.active {
    background: rgba(0,162,197,0.15);
    border-color: rgba(0,162,197,0.3);
    transform: rotate(45deg);
}
html[data-theme='dark'] .plus-btn { color: var(--color-primary); }
html[data-theme='dark'] .plus-btn:hover { background: rgba(0,162,197,0.15); }

.plus-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    min-width: 160px;
    background: var(--color-card, #fff);
    border: 1px solid var(--color-border, rgba(0,0,0,0.1));
    border-radius: 0.625rem;
    box-shadow: var(--shadow-md, 0 10px 25px rgba(2,6,23,0.12));
    padding: 4px 0;
    z-index: 1500;
    animation: scaleIn 140ms ease both;
}
html[data-theme='dark'] .plus-menu {
    background: #0f172a;
    border-color: var(--color-border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}
.plus-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    padding: 8px 14px;
    font-size: 0.875rem;
    color: #212529;
    cursor: pointer;
    border-radius: 0;
    transition: background-color 120ms ease;
}
.plus-menu-item:hover { background: rgba(0,162,197,0.08); }
html[data-theme='dark'] .plus-menu-item { color: #e5e7eb; }
html[data-theme='dark'] .plus-menu-item:hover { background: rgba(255,255,255,0.06); }
.plus-menu-item svg { color: var(--color-primary); flex-shrink: 0; }

/* Location badge inside input area */
.location-badge {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: linear-gradient(135deg, rgba(0,162,197,0.42), rgba(34,174,86,0.38));
    -webkit-backdrop-filter: blur(12px) saturate(1.1);
    backdrop-filter: blur(12px) saturate(1.1);
    color: #ffffff;
    border: 1px solid rgba(0,162,197,0.28);
    border-radius: 1rem;
    padding: 0.5rem 0.75rem 0.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    margin-left: 0.5rem;
    max-width: min(360px, calc(100% - 1rem));
    animation: scaleIn 160ms ease both;
    box-shadow: 0 10px 24px rgba(15,23,42,0.08);
}

#bottom-location-badge {
    position: absolute;
    left: 0.5rem;
    bottom: calc(100% + 0.5rem);
    margin: 0;
    width: fit-content;
    max-width: min(360px, calc(100% - 1rem));
    z-index: 3;
    background: linear-gradient(135deg, rgba(0,162,197,0.76), rgba(34,174,86,0.68));
}

.location-badge-thumb {
    width: 46px;
    height: 46px;
    border-radius: 0.85rem;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.75);
    border: 1px solid rgba(255,255,255,0.75);
}
.location-badge-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.location-badge-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1 1 auto;
}
.location-badge-title {
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.1;
}
.location-badge-meta {
    color: rgba(255,255,255,0.92);
    font-size: 0.7rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.location-badge-remove {
    background: rgba(255,255,255,0.75);
    border: none;
    padding: 0;
    margin-left: auto;
    font-size: 0.7rem;
    line-height: 1;
    color: #0f172a;
    opacity: 0.85;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    transition: opacity 120ms ease, background-color 120ms ease;
}
.location-badge-remove:hover { opacity: 1; background: rgba(0,162,197,0.2); }
html[data-theme='dark'] .location-badge {
    background: linear-gradient(135deg, rgba(0,162,197,0.28), rgba(34,174,86,0.26));
    border-color: rgba(0,162,197,0.38);
    color: #e2f5fb;
    box-shadow: 0 14px 28px rgba(2,6,23,0.32);
}
html[data-theme='dark'] .location-badge-thumb {
    background: rgba(15,23,42,0.8);
    border-color: rgba(148,163,184,0.18);
}
html[data-theme='dark'] .location-badge-title {
    color: #ffffff;
}
html[data-theme='dark'] .location-badge-meta {
    color: rgba(255,255,255,0.9);
}
html[data-theme='dark'] .location-badge-remove {
    background: rgba(15,23,42,0.7);
    color: #e2e8f0;
}

html[data-theme='dark'] #bottom-location-badge {
    background: linear-gradient(135deg, rgba(0,162,197,0.48), rgba(34,174,86,0.42));
    box-shadow: 0 14px 28px rgba(2,6,23,0.32);
}

/* Hero location badge sits above the input, in normal block flow */
#hero-location-badge {
    position: static;
    /* align left edge with the textarea start (offset by plus-btn width 40px) */
    margin-left: 40px;
    margin-top: 0.5rem;
    margin-bottom: 0;
    width: fit-content;
    max-width: calc(100% - 40px);
    background: linear-gradient(135deg, rgba(0,162,197,0.76), rgba(34,174,86,0.68));
}

/* ==========================
     Map Widget – Modal Overlay
     ========================== */
.map-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 5000;
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    padding: 1rem;
    overflow-y: auto;
}
.map-modal-overlay.open {
    display: flex;
    align-items: center;
}
.map-modal-dialog {
    background: var(--color-card, #fff);
    width: min(96vw, 860px);
    max-height: min(92dvh, calc(100dvh - 2rem));
    border-radius: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(2,6,23,0.22);
    border: 1px solid var(--color-border, rgba(0,0,0,0.08));
    animation: scaleIn 200ms ease both;
}
html[data-theme='dark'] .map-modal-dialog {
    background: #0f172a;
    border-color: var(--color-border);
    box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.map-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--color-border, rgba(0,0,0,0.08));
    background: rgba(255,255,255,0.96);
    flex-shrink: 0;
}
html[data-theme='dark'] .map-modal-header {
    background: rgba(15,23,42,0.96);
    border-bottom-color: var(--color-border);
    color: #e5e7eb;
}
.map-modal-instructions {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: var(--color-muted, #64748b);
    background: rgba(0,162,197,0.04);
    border-bottom: 1px solid var(--color-border, rgba(0,0,0,0.06));
    flex-shrink: 0;
}
html[data-theme='dark'] .map-modal-instructions {
    background: rgba(0,162,197,0.06);
    border-bottom-color: var(--color-border);
}
.map-search-overlay {
    position: absolute;
    top: 0.875rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 32rem;
    z-index: 720;
    pointer-events: none;
}
.map-search-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    pointer-events: auto;
}
.map-search-input-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
}
.map-search-lens {
    position: absolute;
    top: 50%;
    left: 0.7rem;
    transform: translateY(-50%);
    color: #94a3b8;
    display: flex;
    align-items: center;
    pointer-events: none;
}
.map-search-input {
    width: 100%;
    height: 2.25rem;
    border-radius: 999px;
    border: 1px solid rgba(100,116,139,0.22);
    padding: 0 2.5rem 0 2.25rem;
    background: rgba(255,255,255,0.96);
    color: #0f172a;
    outline: none;
    font-size: 0.875rem;
    box-shadow: 0 8px 20px rgba(15,23,42,0.11);
}
.map-search-input:focus {
    border-color: rgba(0,162,197,0.45);
    box-shadow: 0 0 0 3px rgba(0,162,197,0.12), 0 10px 22px rgba(15,23,42,0.14);
}
.map-search-clear {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    border: 0;
    border-radius: 50%;
    background: rgba(148,163,184,0.16);
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.map-search-clear:hover,
.map-search-clear:focus-visible {
    background: rgba(0,162,197,0.14);
    color: #0f172a;
}
.map-search-btn {
    display: none;
}
.map-search-results {
    margin-top: 0.5rem;
    border-radius: 1rem;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 18px 38px rgba(15,23,42,0.16);
    border: 1px solid rgba(100,116,139,0.14);
    pointer-events: auto;
    overflow: hidden;
}
.map-search-results-scroll {
    display: grid;
    gap: 0.45rem;
    max-height: min(15rem, calc(100dvh - 20rem));
    overflow-y: auto;
    padding: 0.35rem;
}
.map-search-result {
    width: 100%;
    border: 1px solid rgba(100,116,139,0.16);
    background: rgba(248,250,252,0.96);
    border-radius: 0.85rem;
    padding: 0.65rem 0.8rem;
    text-align: left;
    transition: border-color 140ms, background 140ms, transform 140ms;
}
.map-search-result:hover,
.map-search-result:focus-visible,
.map-search-result.is-active {
    border-color: rgba(0,162,197,0.35);
    background: rgba(240,249,255,0.98);
    transform: translateY(-1px);
}
.map-search-result-title {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
}
.map-search-result-meta {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: #64748b;
}
.map-search-results-empty {
    font-size: 0.8rem;
    color: #64748b;
    padding: 0.45rem 0.55rem;
}
html[data-theme='dark'] .map-search-lens {
    color: #64748b;
}
html[data-theme='dark'] .map-search-input {
    background: rgba(15,23,42,0.9);
    color: #e2e8f0;
    border-color: rgba(148,163,184,0.24);
}
html[data-theme='dark'] .map-search-input::placeholder {
    color: #94a3b8;
}
html[data-theme='dark'] .map-search-clear {
    background: rgba(148,163,184,0.14);
    color: #cbd5e1;
}
html[data-theme='dark'] .map-search-clear:hover,
html[data-theme='dark'] .map-search-clear:focus-visible {
    background: rgba(0,162,197,0.18);
    color: #f8fafc;
}
html[data-theme='dark'] .map-search-results {
    background: rgba(15,23,42,0.94);
    border-color: rgba(148,163,184,0.14);
    box-shadow: 0 18px 38px rgba(0,0,0,0.36);
}
html[data-theme='dark'] .map-search-result {
    background: rgba(15,23,42,0.72);
    border-color: rgba(148,163,184,0.16);
}
html[data-theme='dark'] .map-search-result:hover,
html[data-theme='dark'] .map-search-result:focus-visible,
html[data-theme='dark'] .map-search-result.is-active {
    background: rgba(0,162,197,0.12);
    border-color: rgba(0,162,197,0.36);
}
html[data-theme='dark'] .map-search-result-title {
    color: #f8fafc;
}
html[data-theme='dark'] .map-search-result-meta,
html[data-theme='dark'] .map-search-results-empty {
    color: #94a3b8;
}
.map-container {
    flex: 1 1 auto;
    min-height: clamp(260px, 52dvh, 560px);
    position: relative;
    z-index: 1;
}
.map-container-shell {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}
.map-floating-actions {
    position: absolute;
    bottom: 2.5rem;
    right: 0.875rem;
    z-index: 700;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.map-floating-actions .btn {
    pointer-events: auto;
}
.map-floating-btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(255,255,255,0.96);
    box-shadow: 0 2px 10px rgba(15,23,42,0.22);
    border: 1px solid rgba(0,162,197,0.28);
    color: var(--color-primary);
    transition: background 140ms, box-shadow 140ms;
}
.map-floating-btn:hover {
    background: #fff;
    box-shadow: 0 4px 16px rgba(0,162,197,0.28);
}
.map-floating-btn.is-loading {
    opacity: 0.7;
}
/* GPS button icon */
.map-gps-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}
/* Blue dot – current GPS location marker */
.map-gps-dot {
    width: 16px;
    height: 16px;
    background: #4285f4;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 4px rgba(66,133,244,0.25);
    animation: gpsPulse 1.8s ease-out infinite;
}
@keyframes gpsPulse {
    0%   { box-shadow: 0 0 0 0 rgba(66,133,244,0.45); }
    70%  { box-shadow: 0 0 0 10px rgba(66,133,244,0); }
    100% { box-shadow: 0 0 0 0 rgba(66,133,244,0); }
}
html[data-theme='dark'] .map-floating-btn {
    background: rgba(15,23,42,0.9);
    border-color: rgba(0,162,197,0.4);
    color: #69d9f0;
}
html[data-theme='dark'] .map-floating-btn:hover {
    background: rgba(15,23,42,0.98);
}
/* Override Leaflet z-index so controls sit above our overlay */
.map-container .leaflet-top,
.map-container .leaflet-bottom { z-index: 500; }
.map-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--color-border, rgba(0,0,0,0.08));
    background: rgba(255,255,255,0.96);
    flex-shrink: 0;
    gap: 0.75rem;
    flex-wrap: wrap;
}
html[data-theme='dark'] .map-modal-footer {
    background: rgba(15,23,42,0.96);
    border-top-color: var(--color-border);
}
.map-selection-info {
    font-size: 0.75rem;
    color: var(--color-muted, #64748b);
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.map-selection-info.is-error {
    color: #d63384;
}
/* .map-current-location-btn inherits all styling from .map-floating-btn */
.map-current-location-btn.is-loading {
    opacity: 0.7;
    animation: gpsPulse 1s ease-in-out infinite;
}

@media (max-height: 760px) {
    .map-modal-overlay {
        padding: 0.5rem;
        align-items: flex-start;
    }

    .map-modal-dialog {
        width: min(100vw, 860px);
        max-height: calc(100dvh - 1rem);
        border-radius: 0.875rem;
    }

    .map-modal-header {
        padding: 0.75rem 0.875rem;
    }

    .map-modal-instructions {
        padding: 0.45rem 0.875rem;
        font-size: 0.75rem;
    }

    .map-search-overlay {
        top: 0.625rem;
        left: 50%;
        transform: translateX(-50%);
        width: 80%;
    }

    .map-search-row {
        gap: 0.5rem;
    }

    .map-search-input {
        height: 2.1rem;
    }

    .map-search-results {
        max-height: min(12rem, calc(100dvh - 18rem));
    }

    .map-container {
        min-height: clamp(260px, 48dvh, 380px);
    }

    .map-modal-footer {
        padding: 0.625rem 0.875rem;
        align-items: flex-start;
    }

    .map-selection-info {
        max-width: none;
        white-space: normal;
    }
}

@media (min-height: 900px) {
    .map-modal-dialog {
        max-height: min(94dvh, calc(100dvh - 2rem));
    }

    .map-container {
        min-height: clamp(420px, 62dvh, 720px);
    }
}
.map-current-location-btn.is-loading {
    opacity: 0.8;
}
.map-modal-dialog .btn-outline-secondary {
    border-color: rgba(100,116,139,0.35);
    color: #334155;
}
.map-modal-dialog .btn-outline-secondary:hover,
.map-modal-dialog .btn-outline-secondary:focus-visible {
    background: rgba(148,163,184,0.14);
    border-color: rgba(100,116,139,0.45);
    color: #0f172a;
}
.map-mode-badge {
    font-size: 0.7rem;
    background: rgba(0,162,197,0.1);
    color: var(--color-primary);
    border: 1px solid rgba(0,162,197,0.2);
    border-radius: 2rem;
    padding: 2px 8px;
    font-weight: 500;
}
html[data-theme='dark'] .map-mode-badge { background: rgba(0,162,197,0.18); border-color: rgba(0,162,197,0.3); }
.map-close-btn { font-size: 0.8rem; }
html[data-theme='dark'] .map-selection-info.is-error {
    color: #ff8fbd;
}
html[data-theme='dark'] .map-modal-dialog .btn-outline-secondary {
    color: #e2e8f0;
    border-color: rgba(148,163,184,0.28);
    background: rgba(15,23,42,0.72);
}
html[data-theme='dark'] .map-modal-dialog .btn-outline-secondary:hover,
html[data-theme='dark'] .map-modal-dialog .btn-outline-secondary:focus-visible {
    background: rgba(148,163,184,0.16);
    border-color: rgba(148,163,184,0.45);
    color: #f8fafc;
}
/* .map-current-location-btn dark mode is covered by .map-floating-btn dark rules */

/* Ensure Leaflet draw toolbar styles are legible in dark mode */
html[data-theme='dark'] .leaflet-draw-toolbar a,
html[data-theme='dark'] .leaflet-bar a {
    background-color: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
    box-shadow: 0 6px 18px rgba(2,6,23,0.28);
}
html[data-theme='dark'] .leaflet-bar a:hover,
html[data-theme='dark'] .leaflet-draw-toolbar a:hover {
    background-color: #f8fafc;
}
html[data-theme='dark'] .leaflet-draw-toolbar a.leaflet-draw-toolbar-button-enabled,
html[data-theme='dark'] .leaflet-draw-toolbar a:focus-visible {
    background-color: #c8f1f8;
    border-color: rgba(0,162,197,0.55);
}
html[data-theme='dark'] .leaflet-draw-actions a {
    background: #0f172a;
    color: #e5e7eb;
    border-color: #334155;
}
html[data-theme='dark'] .leaflet-draw-actions a:hover,
html[data-theme='dark'] .leaflet-draw-actions a:focus-visible {
    background: #1e293b;
    color: #f8fafc;
}
html[data-theme='dark'] .leaflet-disabled {
    opacity: 0.55;
}
html[data-theme='dark'] .leaflet-popup-content-wrapper { background: #0f172a; color: #e5e7eb; }
html[data-theme='dark'] .leaflet-popup-tip { background: #0f172a; }

/* Hide dictation buttons when dictating – also hide the plus button */
.input-group.dictating #plus-btn,
.input-group.dictating #hero-plus-btn { opacity:0; visibility:hidden; pointer-events:none; transition:opacity 120ms ease; }
.input-group:not(.dictating) #plus-btn,
.input-group:not(.dictating) #hero-plus-btn { opacity:1; visibility:visible; }


/* PR Widget styles */
.pr-widget-wrapper {
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.pr-widget-wrapper:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.widget-title {
    color: var(--bs-body-color);
    font-weight: 600;
    font-size: 0.875rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bs-border-color);
}

html[data-theme='dark'] .pr-widget-wrapper {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

html[data-theme='dark'] .pr-widget-wrapper:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

html[data-theme='dark'] .widget-title {
    color: var(--bs-body-color);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}
