/* AI Property Search Chat Module Styles — Right-side popout panel */

/* ── Panel container ────────────────────────────────────────── */
.mod-aichat {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 99999;
    height: 100vh;
    width: 300px;
    min-width: 275px;
    max-width: 500px;
    border-left: 1px solid #d0d5dd;
    font-family: 'Rubik', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    background: rgba(247, 248, 250, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translateX(0);
    transition: transform 0.3s ease, width 0.2s ease;
}

/* Collapsed state — slide off-screen, only tab visible */
.mod-aichat.aichat-collapsed {
    transform: translateX(100%) !important;
    pointer-events: none;
}
.mod-aichat:not(.aichat-collapsed) {
    transform: translateX(0) !important;
    pointer-events: auto;
}

/* ── Resize handle (left edge) ──────────────────────────────── */
.aichat-resize-handle {
    position: absolute;
    top: 0;
    left: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
}
.aichat-resize-handle:hover,
.aichat-resize-handle.active {
    background: rgba(26, 115, 232, 0.3);
}

/* ── Floating tab (visible when collapsed) ──────────────────── */
.aichat-tab {
    position: fixed;
    top: 25%;
    right: 0;
    transform: translateY(-50%) translateX(100%);
    z-index: 99999;
    background: var(--aichat-theme, #1a3a5c);
    color: #fff;
    border-radius: 8px 0 0 8px;
    padding: 10px 8px;
    cursor: pointer;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.3);
    user-select: none;
    transition: transform 0.3s ease;
    pointer-events: none;
}
.aichat-tab.visible {
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
}
.aichat-tab:hover {
    padding-right: 12px;
}

/* ── Header ─────────────────────────────────────────────────── */
.aichat-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    color: #fff;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--aichat-theme, #1a3a5c) 0%, #2563eb 100%) !important;
}
.aichat-header-icon {
    font-size: 18px;
    margin-right: 10px;
}
.aichat-header-title {
    flex: 1;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 0.3px;
}
.aichat-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 8px;
}

/* ── Tab bar (Ask LocAI / Manual Search) ─────────────────── */
.aichat-tabbar {
    display: flex;
    background: #fff;
    border-bottom: none;
    flex-shrink: 0;
    padding: 2px 4px 0;
    gap: 2px;
}
.aichat-tabbar-btn {
    flex: 1;
    padding: 8px 8px 7px;
    border: none;
    background: #f0f1f3;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 14.5px;
    color: #6b7280;
    cursor: pointer;
    position: relative;
    transition: color 0.15s, background 0.15s;
    border-radius: 6px 6px 0 0;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.6);
}
.aichat-tabbar-btn:hover {
    color: #374151;
    background: #e8e9ec;
}
.aichat-tabbar-btn.active {
    color: var(--aichat-theme, #1a73e8);
    background: #f7f8fa;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.04), 0 1px 0 #f7f8fa;
}
.aichat-tabbar-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #f7f8fa;
}

/* ── Chat action bar (New Chat + History, pinned at top of Ask LocAI) ── */
.aichat-chat-bar {
    display: flex;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.75);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.aichat-chat-bar-new {
    color: #fff;
    flex: 1;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.aichat-chat-bar-new:hover {
    opacity: 0.9;
}

/* ── Search bar (pinned above sub-tabs in Manual Search) ───── */
.aichat-search-bar {
    display: flex;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}
.aichat-search-bar-btn {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 12.5px;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.15s, background 0.15s;
}
.aichat-search-bar-search {
    color: #fff;
    flex: 1;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.aichat-search-bar-search:hover {
    opacity: 0.9;
}
.aichat-search-bar-search:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.aichat-search-bar-reset {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}
.aichat-search-bar-reset:hover {
    background: #e5e7eb;
}

/* ── Tab panels ─────────────────────────────────────────────── */
.aichat-tab-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: rgba(247, 248, 250, 0.75);
}
.aichat-tab-panel.active {
    display: flex;
}

/* ── Manual Search panel ────────────────────────────────────── */
.aichat-manual-search {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    box-sizing: border-box;
    width: 100%;
}
.aichat-manual-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 16px;
    color: #6b7280;
    font-size: 13px;
}
.aichat-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid #e5e7eb;
    border-top-color: var(--aichat-theme, #1a73e8);
    border-radius: 50%;
    animation: aichat-spin 0.7s linear infinite;
}
@keyframes aichat-spin {
    to { transform: rotate(360deg); }
}

/* ── OS Property form restyled inside widget ────────────────── */
.aichat-manual-search #ospropertyadvsearch {
    font-size: 12px;
    width: 100%;
    box-sizing: border-box;
}
.aichat-manual-search form {
    width: 100%;
    box-sizing: border-box;
}
.aichat-manual-search #ospropertyadvsearch .searchfields {
    margin-bottom: 10px;
}
.aichat-manual-search #ospropertyadvsearch strong {
    font-family: 'Nunito', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: #374151;
    display: block;
    margin-bottom: 3px;
}
.aichat-manual-search #ospropertyadvsearch input[type="text"],
.aichat-manual-search #ospropertyadvsearch select,
.aichat-manual-search #ospropertyadvsearch .form-select,
.aichat-manual-search #ospropertyadvsearch .form-control {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    box-sizing: border-box;
}
.aichat-manual-search #ospropertyadvsearch input[type="range"] {
    width: 100%;
}
.aichat-manual-search #ospropertyadvsearch .price-range {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.aichat-manual-search #ospropertyadvsearch .price-values {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #6b7280;
}
/* Fields stack vertically by default; container queries override at wider widths */
.aichat-manual-search #ospropertyadvsearch .row,
.aichat-manual-search #ospropertyadvsearch .row-fluid,
.aichat-manual-search #ospropertyadvsearch [class*="row"] {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.aichat-manual-search #ospropertyadvsearch [class*="col-"],
.aichat-manual-search #ospropertyadvsearch [class*="span"] {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}
/* ── Our custom sub-tabs for Manual Search ──────────────── */
.aichat-subtabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 0 2px;
    margin-bottom: 0;
}
.aichat-subtab-btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 6px 10px;
    border: none;
    border-radius: 5px 5px 0 0;
    background: #e8e9ec;
    color: #374151;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 11.5px;
    white-space: nowrap;
    box-shadow: inset 0 -2px 4px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.6);
    transition: background 0.15s, color 0.15s;
}
.aichat-subtab-btn:hover {
    background: #dcdee2;
}
.aichat-subtab-btn.active {
    background: #fff;
    color: var(--aichat-theme, #1a73e8);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.04), 0 1px 0 #fff;
}
.aichat-subtab-content {
    border: 1px solid #d1d5db;
    border-radius: 0 0 6px 6px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.75);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
    box-sizing: border-box;
    width: 100%;
}
.aichat-subtab-pane {
    display: none;
}
.aichat-subtab-pane.active {
    display: block;
}
/* ── Accordion sections within sub-tabs ──────────────── */
.aichat-accordion {
    margin-bottom: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: visible;
}
.aichat-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 6px 6px 0 0;
    background: linear-gradient(to bottom, #f8f9fa, #eef0f3);
    color: #374151;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 12px;
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.7);
    transition: background 0.15s;
}
.aichat-accordion-header:hover {
    background: linear-gradient(to bottom, #eef0f3, #e5e7eb);
}
.aichat-accordion-header.open {
    background: linear-gradient(to bottom, #edf2ff, #e0e8f5);
    color: var(--aichat-theme, #1a73e8);
}
.aichat-accordion-title {
    flex: 1;
    text-align: left;
}
.aichat-accordion-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    margin-left: 8px;
}
.aichat-accordion-header.open .aichat-accordion-arrow {
    transform: rotate(180deg);
}
.aichat-accordion-body {
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.70);
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 6px 6px;
    box-sizing: border-box;
    width: 100%;
}
/* Keep inputs, selects, and buttons fully opaque */
.aichat-accordion-body input[type="text"],
.aichat-accordion-body input[type="number"],
.aichat-accordion-body input[type="range"],
.aichat-accordion-body select,
.aichat-accordion-body button,
.aichat-accordion-body .aichat-dropdown-trigger,
.aichat-accordion-body .aichat-dropdown-menu,
.aichat-accordion-body .switch-label {
    opacity: 1;
    background-color: #fff;
}
.aichat-accordion-body * {
    box-sizing: border-box;
}
/* ── Custom search form field grid ─────────────────────── */
.aichat-field-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.aichat-field {
    flex: 0 0 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.aichat-field strong {
    font-family: 'Nunito', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: #374151;
    display: block;
    margin-bottom: 3px;
}
.aichat-field input[type="text"],
.aichat-field input[type="number"],
.aichat-field select {
    width: 100%;
    max-width: 100%;
    font-size: 12px;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    box-sizing: border-box;
    font-family: 'Rubik', sans-serif;
}
.aichat-field input[type="range"] {
    width: 100%;
}
.aichat-field .price-range {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.aichat-field .price-values {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #6b7280;
}
.aichat-range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}
.aichat-range-inputs input {
    flex: 1;
    min-width: 0;
}
.aichat-range-inputs span {
    color: #9ca3af;
}
/* Amenity grid */
.aichat-amenity-group {
    margin-bottom: 10px;
}
.aichat-amenity-group-title {
    margin-bottom: 4px;
}
.aichat-amenity-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.aichat-amenity-grid .switch-container {
    flex: 0 0 calc(50% - 2px);
    max-width: calc(50% - 2px);
    box-sizing: border-box;
    font-size: 11.5px;
    margin-bottom: 2px;
    position: relative;
}
.aichat-amenity-grid .switch-container.hidden-amenity {
    display: none;
}
.amenity-count {
    font-size: 9px;
    color: #9ca3af;
    font-weight: 600;
    margin-left: 2px;
    white-space: nowrap;
}
.amenity-count.zero {
    color: #d1d5db;
}
/* Extra field groups */
.aichat-extra-group {
    margin-bottom: 10px;
}
.aichat-extra-group-title {
    font-family: 'Nunito', sans-serif;
    font-size: 11.5px;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 6px;
    padding-bottom: 3px;
    border-bottom: 1px solid #e5e7eb;
}
.aichat-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.aichat-cb-label {
    font-size: 11.5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
/* Legacy OS Property nav-tabs — re-init if they exist */
.aichat-manual-search #ospropertyadvsearch .nav-tabs,
.aichat-manual-search #ospropertyadvsearch .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    border-bottom: none;
    margin-bottom: 0;
}
.aichat-manual-search #ospropertyadvsearch .tab-pane {
    display: none;
}
.aichat-manual-search #ospropertyadvsearch .tab-pane.active,
.aichat-manual-search #ospropertyadvsearch .tab-pane.show {
    display: block;
}
/* Amenity checkboxes — compact grid */
.aichat-manual-search #ospropertyadvsearch .switch-container {
    margin-bottom: 4px;
    font-size: 11.5px;
}
/* Buttons at bottom */
.aichat-manual-search #ospropertyadvsearch .searchbtns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}
.aichat-manual-search #ospropertyadvsearch .searchbtns .modern-btn {
    font-size: 12px;
    padding: 7px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
}
.aichat-manual-search #ospropertyadvsearch .searchbtns .btn-search {
    background: var(--aichat-theme, #1a73e8);
    color: #fff;
    flex: 1;
}
.aichat-manual-search #ospropertyadvsearch .searchbtns .btn-reset {
    background: #f3f4f6;
    color: #374151;
}
.aichat-manual-search #ospropertyadvsearch .searchbtns .btn-save,
.aichat-manual-search #ospropertyadvsearch .searchbtns .btn-update {
    background: #f3f4f6;
    color: #374151;
    font-size: 11px;
}
/* ── Multi-select dropdown widget ────────────────────────── */
.aichat-multiselect {
    position: relative;
    width: 100%;
}
.aichat-ms-trigger {
    width: 100%;
    text-align: left;
    font-size: 12px;
    padding: 6px 28px 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E") no-repeat right 8px center;
    cursor: pointer;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Rubik', sans-serif;
    box-sizing: border-box;
}
.aichat-ms-trigger:hover {
    border-color: #9ca3af;
}
.aichat-ms-trigger.has-selection {
    color: #1f2937;
    font-weight: 500;
}
.aichat-ms-dropdown {
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 200px;
    overflow-y: auto;
    margin-top: -1px;
}
.aichat-ms-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #374151;
    transition: background 0.1s;
    border-bottom: 1px solid #f3f4f6;
}
.aichat-ms-item:last-child {
    border-bottom: none;
}
.aichat-ms-item:hover {
    background: #f0f7ff;
}
.aichat-ms-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--aichat-theme, #1a73e8);
    flex-shrink: 0;
    cursor: pointer;
}
.aichat-ms-item span {
    flex: 1;
    line-height: 1.3;
}

/* ── New .aichat-dropdown multi-select widget ──────────────── */
.aichat-dropdown {
    position: relative;
    width: 100%;
}
.aichat-dropdown-trigger {
    width: 100%;
    text-align: left;
    font-size: 12px;
    padding: 6px 28px 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E") no-repeat right 8px center;
    cursor: pointer;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Rubik', sans-serif;
    box-sizing: border-box;
}
.aichat-dropdown-trigger:hover {
    border-color: #9ca3af;
}
.aichat-dropdown-trigger.has-selection {
    color: #1f2937;
    font-weight: 500;
}
.aichat-dropdown-menu {
    display: none;
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    max-height: 200px;
    overflow-y: auto;
    margin-top: -1px;
}
.aichat-dropdown.open .aichat-dropdown-menu {
    display: block;
}
.aichat-dropdown.open .aichat-dropdown-trigger {
    border-color: var(--aichat-theme, #1a73e8);
    border-radius: 6px 6px 0 0;
}
.aichat-dropdown-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #374151;
    transition: background 0.1s;
    border-bottom: 1px solid #f3f4f6;
}
.aichat-dropdown-item:last-child {
    border-bottom: none;
}
.aichat-dropdown-item:hover {
    background: #f0f7ff;
}
.aichat-dropdown-item input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: var(--aichat-theme, #1a73e8);
    flex-shrink: 0;
    cursor: pointer;
}
.aichat-dropdown-item span {
    flex: 1;
    line-height: 1.3;
}

/* Legacy multi-select custom dropdowns (OS Property native) */
.aichat-manual-search .custom-multi-select {
    position: relative;
    width: 100%;
    margin-bottom: 6px;
}
.aichat-manual-search .custom-multi-select .selected-items {
    display: block;
    width: 100%;
    padding: 6px 28px 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E") no-repeat right 8px center;
    cursor: pointer;
    font-size: 12px;
    color: #6b7280;
    box-sizing: border-box;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.aichat-manual-search .custom-multi-select.open .selected-items {
    border-color: var(--aichat-theme, #1a73e8);
}
.aichat-manual-search .custom-multi-select .dropdown-content {
    display: none;
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 180px;
    overflow-y: auto;
    font-size: 11.5px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    box-sizing: border-box;
}
.aichat-manual-search .custom-multi-select.open .dropdown-content {
    display: block;
}
.aichat-manual-search .custom-multi-select .dropdown-content label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 11.5px;
}
.aichat-manual-search .custom-multi-select .dropdown-content label:hover {
    background: #f0f7ff;
}
/* More options section */
.aichat-manual-search #more_option_div,
.aichat-accordion-body #more_option_div {
    margin-top: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}
.aichat-manual-search #more_option_div .field-group,
.aichat-manual-search #more_option_div .more-options-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.aichat-manual-search #more_option_div .field-item,
.aichat-manual-search #more_option_div input,
.aichat-manual-search #more_option_div select {
    max-width: 100%;
    box-sizing: border-box;
}
.aichat-manual-search .more_option {
    font-size: 12px;
    color: var(--aichat-theme, #1a73e8);
    cursor: pointer;
    font-weight: 600;
}
/* Extra field groups */
.aichat-manual-search .field-group {
    margin-bottom: 8px;
}
.aichat-manual-search .field-group .block_caption {
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 4px;
    color: #374151;
}
/* Hide geolocation button (doesn't work inside widget) */
.aichat-manual-search .adv_geoloc_icon {
    display: none;
}

/* ── Manual search: context notice ──────────────────────────── */
.aichat-context-notice {
    background: #eef4ff;
    border: 1px solid #c7d7fe;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 10px;
    font-size: 11.5px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}
.aichat-context-notice strong {
    color: var(--aichat-theme, #1a73e8);
}

/* ── History panel (slide-down drawer) ────────────────────── */
.aichat-history-panel {
    max-height: 50vh;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.75);
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    flex-shrink: 0;
}
.aichat-history-list {
    padding: 8px 0;
}
.aichat-history-loading,
.aichat-history-empty {
    text-align: center;
    padding: 16px;
    color: #9ca3af;
    font-size: 12px;
}
.aichat-history-item {
    position: relative;
    padding: 10px 36px 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}
.aichat-history-item:hover {
    background: #f0f7ff;
}
.aichat-history-item.active {
    background: #e8f0fe;
    border-left: 3px solid var(--aichat-theme, #1a73e8);
    padding-left: 11px;
}
.aichat-history-title {
    font-size: 12.5px;
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}
.aichat-history-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}
.aichat-history-delete {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #d1d5db;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}
.aichat-history-delete:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* History tabs (Chats / Searches) */
.aichat-history-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.6);
    position: sticky;
    top: 0;
    z-index: 1;
}
.aichat-history-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.aichat-history-tab:hover {
    background: rgba(26, 115, 232, 0.05);
    color: #1f2937;
}
.aichat-history-tab.active {
    color: var(--aichat-theme, #1a73e8);
    border-bottom-color: var(--aichat-theme, #1a73e8);
}

/* Search history badge for result count */
.aichat-history-badge {
    display: inline-block;
    background: #eef2ff;
    color: #4338ca;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 6px;
}
.aichat-history-badge.zero {
    background: #f3f4f6;
    color: #9ca3af;
}

/* ── Body ───────────────────────────────────────────────────── */
.aichat-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: rgba(247, 248, 250, 0.75);
}

/* ── Messages ───────────────────────────────────────────────── */
.aichat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    scroll-behavior: smooth;
}
.aichat-message {
    margin-bottom: 14px;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
}
.aichat-message--bot {
    justify-content: flex-start;
}
.aichat-message--user {
    justify-content: flex-end;
}

/* ── Bot avatar ────────────────────────────────────────────── */
.aichat-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aichat-theme, #1a3a5c), #2563eb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-top: 2px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ── Chat bubbles ──────────────────────────────────────────── */
.aichat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.6;
    word-wrap: break-word;
    font-size: 13.5px;
}
.aichat-message--bot .aichat-bubble {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    color: #1f2937;
}
.aichat-message--user .aichat-bubble {
    background: linear-gradient(135deg, var(--aichat-theme, #1a73e8), #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ── Rich-text formatting inside bot bubbles ───────────────── */
.aichat-bubble p {
    margin: 0 0 8px 0;
}
.aichat-bubble p:last-child {
    margin-bottom: 0;
}
.aichat-bubble .aichat-spacer {
    height: 6px;
}
.aichat-bubble ul,
.aichat-bubble ol {
    margin: 6px 0 10px 0;
    padding-left: 20px;
}
.aichat-bubble li {
    margin-bottom: 4px;
    line-height: 1.5;
}
.aichat-bubble ul li {
    list-style-type: disc;
}
.aichat-bubble ol li {
    list-style-type: decimal;
}
.aichat-bubble ul li::marker {
    color: var(--aichat-theme, #1a73e8);
}
.aichat-bubble ol li::marker {
    color: var(--aichat-theme, #1a73e8);
    font-weight: 600;
}
.aichat-bubble strong {
    font-weight: 600;
    color: #111827;
}
.aichat-bubble em {
    font-style: italic;
}

/* ── Response headings (replaces ### markdown) ────────────── */
.aichat-heading {
    font-family: 'Nunito', sans-serif;
    font-size: 16.5px;
    font-weight: 800;
    color: #111827;
    margin: 10px 0 6px 0;
    line-height: 1.3;
}
.aichat-heading:first-child {
    margin-top: 0;
}

/* ── Source/reference labels ──────────────────────────────── */
.aichat-source-label {
    font-size: 15.5px;
    font-weight: 600;
    color: #374151;
    margin-top: 10px;
}

/* ── Inline links in bot bubbles (show site name, not full URL) ── */
.aichat-link {
    font-family: 'Inter', sans-serif;
    color: var(--aichat-theme, #1a73e8);
    text-decoration: none;
    font-weight: 600;
    font-size: 12.5px;
    background: #eef4ff;
    padding: 1px 7px;
    border-radius: 10px;
    border: 1px solid rgba(26, 115, 232, 0.2);
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.aichat-link:hover {
    background: var(--aichat-theme, #1a73e8);
    color: #fff;
    text-decoration: none;
}

/* ── Tier group labels ──────────────────────────────────────── */
.aichat-tier-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    background: #e5e7eb;
    border-radius: 6px;
    padding: 4px 10px;
    margin-top: 8px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ── Property result cards ──────────────────────────────────── */
.aichat-property-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 0;
    margin-top: 6px;
    max-width: 95%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
    display: flex;
    overflow: hidden;
}
.aichat-property-card:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}
/* Left: property info */
.aichat-prop-info {
    padding: 10px 12px;
    flex: 1;
    min-width: 0;
}
.aichat-property-card h5 {
    margin: 0 0 4px;
    font-size: 13px;
    color: #1f2937;
    font-weight: 600;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}
.aichat-property-card .price {
    font-weight: 700;
    color: var(--aichat-theme, #1a73e8);
    font-size: 14px;
}
.aichat-prop-id-row {
    margin-top: 3px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}
.aichat-prop-id {
    display: inline-block;
    background: #e5e7eb;
    color: #374151;
    font-weight: 600;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
}
.aichat-prop-type {
    display: inline-block;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
}
.aichat-property-card .details {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.4;
}
.aichat-property-card .details.specs {
    font-weight: 600;
    color: #374151;
}
.aichat-property-card .details.location {
    color: #6b7280;
}
/* Left: thumbnail + view button */
.aichat-prop-left {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 110px;
    background: #f9fafb;
}
.aichat-prop-thumb {
    position: relative;
    width: 110px;
    height: 90px;
    flex-shrink: 0;
    background: #f3f4f6;
    overflow: hidden;
}
.aichat-prop-thumb--empty {
    height: auto;
    min-height: 22px;
}
.aichat-prop-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
/* Listing type badge overlay on thumbnail */
.aichat-listing-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    z-index: 1;
    line-height: 1.2;
    white-space: nowrap;
}

/* ── Source cards (grouped by site) ────────────────────────── */
.aichat-sources-container {
    max-width: 90%;
    margin-top: 8px;
}
.aichat-sources-header {
    font-size: 14px;
    color: #374151;
    margin-bottom: 6px;
}
.aichat-source-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.aichat-source-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.aichat-source-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.aichat-source-card-header:hover {
    background: #f9fafb;
}
.aichat-source-favicon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}
.aichat-source-site {
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #1f2937;
    flex: 1;
}
.aichat-source-count {
    font-size: 10.5px;
    color: #9ca3af;
    font-weight: 500;
}
.aichat-source-toggle {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 10px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    transition: color 0.15s;
}
.aichat-source-toggle:hover {
    color: #6b7280;
}
.aichat-source-refs {
    padding: 0 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: max-height 0.25s ease, opacity 0.2s ease;
    max-height: 300px;
    opacity: 1;
}
.aichat-source-refs.collapsed {
    max-height: 0;
    opacity: 0;
    padding: 0 12px;
    overflow: hidden;
}
.aichat-source-ref {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--aichat-theme, #1a73e8);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    background: #f0f7ff;
    border: 1px solid #e0eaf8;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s, color 0.15s;
}
.aichat-source-ref:hover {
    background: var(--aichat-theme, #1a73e8);
    color: #fff;
    text-decoration: none;
}

/* View property link in card — small pill button below thumb */
.aichat-view-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 6px 0;
    font-family: 'Nunito', sans-serif;
    font-size: 10px;
    color: var(--aichat-theme, #1a73e8);
    text-decoration: none;
    font-weight: 700;
    padding: 3px 10px;
    border: 1.5px solid var(--aichat-theme, #1a73e8);
    border-radius: 14px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.aichat-view-link:hover {
    background: var(--aichat-theme, #1a73e8);
    color: #fff;
    text-decoration: none;
}

/* View all in search button */
.aichat-search-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
}
.aichat-search-btn:hover {
    background: #1557b0;
}

/* ── Nearby amenities/attractions cards ─────────────────────── */
.aichat-amenity-container {
    max-width: 90%;
    margin-top: 6px;
}
.aichat-amenity-header {
    font-size: 13px;
    margin-bottom: 8px;
    color: #374151;
}
.aichat-amenity-card {
    background: #f0f7ff;
    border: 1px solid #d1e3f8;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 1.5;
}
.aichat-amenity-card h5 {
    margin: 0 0 4px;
    font-size: 13px;
    color: #1f2937;
    font-weight: 600;
    display: inline;
}
.aichat-amenity-rating {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.aichat-amenity-rating.excellent {
    background: #dcfce7;
    color: #166534;
}
.aichat-amenity-rating.good {
    background: #e0f2fe;
    color: #075985;
}
.aichat-amenity-rating.moderate {
    background: #fef9c3;
    color: #854d0e;
}
.aichat-amenity-distance {
    font-size: 11px;
    color: #6b7280;
    margin: 4px 0;
    font-style: italic;
}
.aichat-amenity-section {
    margin-top: 6px;
}
.aichat-amenity-section strong {
    font-size: 11px;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.aichat-amenity-section ul {
    margin: 2px 0 0;
    padding-left: 16px;
    list-style: disc;
}
.aichat-amenity-section li {
    font-size: 11.5px;
    color: #374151;
    margin-bottom: 1px;
}

/* ── Typing indicator ───────────────────────────────────────── */
.aichat-typing {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}
.aichat-typing span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: aichat-bounce 1.4s infinite ease-in-out;
}
.aichat-typing span:nth-child(2) { animation-delay: 0.2s; }
.aichat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aichat-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* ── Input area ─────────────────────────────────────────────── */
.aichat-input-area {
    display: flex;
    align-items: flex-end;
    padding: 12px 14px;
    border-top: 1px solid #e5e7eb;
    background: rgba(255, 255, 255, 0.75);
    flex-shrink: 0;
    gap: 8px;
}
.aichat-input {
    flex: 1;
    border: 1.5px solid #d1d5db;
    border-radius: 16px;
    padding: 10px 16px;
    font-size: 13.5px;
    font-family: 'Rubik', sans-serif;
    outline: none;
    resize: none;
    overflow-y: auto;
    word-wrap: break-word;
    line-height: 1.4;
    background: #f9fafb;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}
.aichat-input:focus {
    border-color: var(--aichat-theme, #1a73e8);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.aichat-send-btn {
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, opacity 0.15s;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.aichat-send-btn:hover {
    transform: scale(1.08);
    opacity: 0.95;
}
.aichat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ── Revision label ─────────────────────────────────────────── */
.aichat-revision-label {
    text-align: right;
    font-size: 9px;
    font-style: italic;
    color: #9ca3af;
    padding: 2px 8px;
    font-family: 'Rubik', sans-serif;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

/* ── Account info ───────────────────────────────────────────── */
.aichat-account-info {
    background: #f0f7ff;
    border: 1px solid #c2dbf5;
    border-radius: 8px;
    padding: 10px;
    margin-top: 6px;
    max-width: 90%;
    font-size: 13px;
}
.aichat-account-info .label {
    font-weight: 600;
    color: #333;
}
.aichat-account-info .value {
    color: #555;
}

/* ── Property Specifications sub-header (moved from Other tab) ── */
.aichat-spec-header {
    margin-top: 14px;
    padding-top: 10px;
    border-top: 2px solid #e5e7eb;
}
.aichat-spec-header strong {
    font-family: 'Nunito', sans-serif;
    font-size: 12.5px;
    font-weight: 800;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Fix form fields inside widget ─────────────────────────── */
/* Ensure all interactive elements respond after AJAX injection */
.aichat-manual-search select,
.aichat-manual-search input,
.aichat-manual-search button,
.aichat-manual-search textarea,
.aichat-manual-search .custom-multi-select,
.aichat-manual-search .dropdown-select,
.aichat-manual-search [class*="custom-select"] {
    pointer-events: auto !important;
    -webkit-appearance: auto;
    appearance: auto;
}
/* Category and Amenity multi-select dropdowns */
.aichat-manual-search .custom-multi-select .dropdown-content,
.aichat-manual-search .dropdown-menu {
    position: absolute;
    z-index: 100;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 180px;
    overflow-y: auto;
    width: 100%;
    left: 0;
}
.aichat-manual-search .custom-multi-select .dropdown-content label,
.aichat-manual-search .custom-multi-select .dropdown-content li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 11.5px;
}
.aichat-manual-search .custom-multi-select .dropdown-content label:hover,
.aichat-manual-search .custom-multi-select .dropdown-content li:hover {
    background: #f0f7ff;
}
/* Ensure select dropdowns are visible and functional */
.aichat-manual-search select {
    -webkit-appearance: menulist;
    appearance: menulist;
    cursor: pointer;
}
/* More Options styling */
.aichat-manual-search .more_option,
.aichat-manual-search [class*="more_option"] a,
.aichat-manual-search a.more_option {
    pointer-events: auto !important;
    cursor: pointer !important;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .mod-aichat {
        width: 100vw;
        min-width: unset;
        border-left: none;
    }
    .aichat-resize-handle {
        display: none;
    }
    .aichat-tabbar-btn {
        font-size: 12px;
        padding: 8px 6px;
    }
}

/* ── Fix: widget must stay stuck to right edge at all widths ── */
.mod-aichat {
    right: 0 !important;
    left: auto !important;
}

/* ── Manual Search responsive to widget width ─────────────── */
/* Use container query for responsive form layout when widget is resized */
.mod-aichat {
    container-type: inline-size;
    container-name: aichat-widget;
}

/* Default (narrow): single column — all field wrappers stack */
.aichat-accordion-body .searchfields,
.aichat-accordion-body fieldset,
.aichat-accordion-body .field-row,
.aichat-accordion-body > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

/* At 400px+, fields go to 2 columns, amenities go to 3 columns */
@container aichat-widget (min-width: 400px) {
    .aichat-field {
        flex: 0 0 calc(50% - 4px);
        max-width: calc(50% - 4px);
    }
    .aichat-field.aichat-field-wide {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .aichat-amenity-grid .switch-container {
        flex: 0 0 calc(33.33% - 3px);
        max-width: calc(33.33% - 3px);
    }
    /* Legacy OS Property selectors (fallback) */
    .aichat-accordion-body .searchfields,
    .aichat-accordion-body fieldset,
    .aichat-accordion-body .field-row {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
    .aichat-accordion-body .searchfields > div,
    .aichat-accordion-body fieldset > div,
    .aichat-accordion-body .field-row > div {
        flex: 0 0 calc(50% - 4px);
        min-width: 0;
        box-sizing: border-box;
    }
}

/* At 475px+, fields go to 3 columns (33%/33%/34%) */
@container aichat-widget (min-width: 475px) {
    .aichat-field {
        flex: 0 0 calc(33.33% - 6px);
        max-width: calc(33.33% - 6px);
    }
    .aichat-field.aichat-field-wide {
        flex: 0 0 100%;
        max-width: 100%;
    }
    .aichat-accordion-body .searchfields > div,
    .aichat-accordion-body fieldset > div,
    .aichat-accordion-body .field-row > div {
        flex: 0 0 calc(33.33% - 6px);
        min-width: 0;
        box-sizing: border-box;
    }
}

/* Narrow widget — stack property cards vertically */
@container aichat-widget (max-width: 280px) {
    .aichat-property-card {
        flex-direction: column;
    }
    .aichat-prop-left {
        width: 100%;
    }
    .aichat-prop-thumb {
        width: 100%;
        height: 120px;
    }
}

/* Narrow widget — compact everything */
@container aichat-widget (max-width: 320px) {
    .aichat-subtab-btn {
        font-size: 10px;
        padding: 5px 6px;
    }
    .aichat-subtab-content {
        padding: 4px;
    }
    .aichat-accordion-header {
        padding: 6px 8px;
        font-size: 11px;
    }
    .aichat-accordion-body {
        padding: 6px 8px;
    }
    .aichat-tabbar-btn {
        font-size: 11px;
        padding: 7px 4px;
    }
    .aichat-bubble {
        max-width: 95%;
    }
    .aichat-messages {
        padding: 10px;
    }
}

/* Chat messages also respond to width */
@container aichat-widget (min-width: 500px) {
    .aichat-messages {
        padding: 20px 24px;
    }
    .aichat-bubble {
        max-width: 80%;
    }
}

/* ════════════════════════════════════════════════════════════════
   DARK MODE OVERRIDES
   ════════════════════════════════════════════════════════════════ */

/* ── Panel container & body ─────────────────────────────────── */
[data-bs-theme="dark"] .mod-aichat,
[data-theme="dark"] .mod-aichat,
.dark-mode .mod-aichat {
    background: rgba(25, 25, 25, 0.90);
    border-left-color: #444;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] .aichat-body,
[data-theme="dark"] .aichat-body,
.dark-mode .aichat-body {
    background: rgba(25, 25, 25, 0.90);
}

[data-bs-theme="dark"] .aichat-tab-panel,
[data-theme="dark"] .aichat-tab-panel,
.dark-mode .aichat-tab-panel {
    background: rgba(25, 25, 25, 0.90);
}

/* ── Tab bar ────────────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-tabbar,
[data-theme="dark"] .aichat-tabbar,
.dark-mode .aichat-tabbar {
    background: #1e1e1e;
}

[data-bs-theme="dark"] .aichat-tabbar-btn,
[data-theme="dark"] .aichat-tabbar-btn,
.dark-mode .aichat-tabbar-btn {
    background: #333;
    color: #999;
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .aichat-tabbar-btn:hover,
[data-theme="dark"] .aichat-tabbar-btn:hover,
.dark-mode .aichat-tabbar-btn:hover {
    color: #ccc;
    background: #3a3a3a;
}

[data-bs-theme="dark"] .aichat-tabbar-btn.active,
[data-theme="dark"] .aichat-tabbar-btn.active,
.dark-mode .aichat-tabbar-btn.active {
    background: #2a2a2a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 0 #2a2a2a;
}

[data-bs-theme="dark"] .aichat-tabbar-btn.active::after,
[data-theme="dark"] .aichat-tabbar-btn.active::after,
.dark-mode .aichat-tabbar-btn.active::after {
    background: #2a2a2a;
}

/* ── Chat action bar & search bar ───────────────────────────── */
[data-bs-theme="dark"] .aichat-chat-bar,
[data-theme="dark"] .aichat-chat-bar,
.dark-mode .aichat-chat-bar {
    background: rgba(30, 30, 30, 0.85);
    border-bottom-color: #444;
}

[data-bs-theme="dark"] .aichat-search-bar,
[data-theme="dark"] .aichat-search-bar,
.dark-mode .aichat-search-bar {
    background: rgba(30, 30, 30, 0.85);
    border-bottom-color: #444;
}

[data-bs-theme="dark"] .aichat-search-bar-reset,
[data-theme="dark"] .aichat-search-bar-reset,
.dark-mode .aichat-search-bar-reset {
    background: #333;
    color: #ccc;
    border-color: #555;
}

[data-bs-theme="dark"] .aichat-search-bar-reset:hover,
[data-theme="dark"] .aichat-search-bar-reset:hover,
.dark-mode .aichat-search-bar-reset:hover {
    background: #444;
}

/* ── Sub-tabs (Manual Search) ───────────────────────────────── */
[data-bs-theme="dark"] .aichat-subtab-btn,
[data-theme="dark"] .aichat-subtab-btn,
.dark-mode .aichat-subtab-btn {
    background: #333;
    color: #ccc;
    box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .aichat-subtab-btn:hover,
[data-theme="dark"] .aichat-subtab-btn:hover,
.dark-mode .aichat-subtab-btn:hover {
    background: #3a3a3a;
}

[data-bs-theme="dark"] .aichat-subtab-btn.active,
[data-theme="dark"] .aichat-subtab-btn.active,
.dark-mode .aichat-subtab-btn.active {
    background: #2a2a2a;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 0 #2a2a2a;
}

[data-bs-theme="dark"] .aichat-subtab-content,
[data-theme="dark"] .aichat-subtab-content,
.dark-mode .aichat-subtab-content {
    background: rgba(40, 40, 40, 0.85);
    border-color: #555;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ── Accordion ──────────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-accordion,
[data-theme="dark"] .aichat-accordion,
.dark-mode .aichat-accordion {
    border-color: #444;
}

[data-bs-theme="dark"] .aichat-accordion-header,
[data-theme="dark"] .aichat-accordion-header,
.dark-mode .aichat-accordion-header {
    background: linear-gradient(to bottom, #333, #2a2a2a);
    color: #ccc;
    box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-bs-theme="dark"] .aichat-accordion-header:hover,
[data-theme="dark"] .aichat-accordion-header:hover,
.dark-mode .aichat-accordion-header:hover {
    background: linear-gradient(to bottom, #3a3a3a, #333);
}

[data-bs-theme="dark"] .aichat-accordion-header.open,
[data-theme="dark"] .aichat-accordion-header.open,
.dark-mode .aichat-accordion-header.open {
    background: linear-gradient(to bottom, #1a2a3a, #1e3050);
}

[data-bs-theme="dark"] .aichat-accordion-body,
[data-theme="dark"] .aichat-accordion-body,
.dark-mode .aichat-accordion-body {
    background: rgba(40, 40, 40, 0.80);
    border-top-color: #444;
}

[data-bs-theme="dark"] .aichat-accordion-body input[type="text"],
[data-bs-theme="dark"] .aichat-accordion-body input[type="number"],
[data-bs-theme="dark"] .aichat-accordion-body select,
[data-bs-theme="dark"] .aichat-accordion-body .aichat-dropdown-trigger,
[data-bs-theme="dark"] .aichat-accordion-body .aichat-dropdown-menu,
[data-theme="dark"] .aichat-accordion-body input[type="text"],
[data-theme="dark"] .aichat-accordion-body input[type="number"],
[data-theme="dark"] .aichat-accordion-body select,
[data-theme="dark"] .aichat-accordion-body .aichat-dropdown-trigger,
[data-theme="dark"] .aichat-accordion-body .aichat-dropdown-menu,
.dark-mode .aichat-accordion-body input[type="text"],
.dark-mode .aichat-accordion-body input[type="number"],
.dark-mode .aichat-accordion-body select,
.dark-mode .aichat-accordion-body .aichat-dropdown-trigger,
.dark-mode .aichat-accordion-body .aichat-dropdown-menu {
    background-color: #1e1e1e;
    color: #e0e0e0;
    border-color: #555;
}

/* ── Form fields & labels ───────────────────────────────────── */
[data-bs-theme="dark"] .aichat-field strong,
[data-theme="dark"] .aichat-field strong,
.dark-mode .aichat-field strong {
    color: #ccc;
}

[data-bs-theme="dark"] .aichat-field input[type="text"],
[data-bs-theme="dark"] .aichat-field input[type="number"],
[data-bs-theme="dark"] .aichat-field select,
[data-theme="dark"] .aichat-field input[type="text"],
[data-theme="dark"] .aichat-field input[type="number"],
[data-theme="dark"] .aichat-field select,
.dark-mode .aichat-field input[type="text"],
.dark-mode .aichat-field input[type="number"],
.dark-mode .aichat-field select {
    background: #1e1e1e;
    border-color: #555;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .aichat-field .price-values,
[data-theme="dark"] .aichat-field .price-values,
.dark-mode .aichat-field .price-values {
    color: #888;
}

[data-bs-theme="dark"] .aichat-range-inputs span,
[data-theme="dark"] .aichat-range-inputs span,
.dark-mode .aichat-range-inputs span {
    color: #888;
}

/* ── OS Property form fields inside widget ──────────────────── */
[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch strong,
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch strong,
.dark-mode .aichat-manual-search #ospropertyadvsearch strong {
    color: #ccc;
}

[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch input[type="text"],
[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch select,
[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch .form-select,
[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch .form-control,
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch input[type="text"],
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch select,
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch .form-select,
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch .form-control,
.dark-mode .aichat-manual-search #ospropertyadvsearch input[type="text"],
.dark-mode .aichat-manual-search #ospropertyadvsearch select,
.dark-mode .aichat-manual-search #ospropertyadvsearch .form-select,
.dark-mode .aichat-manual-search #ospropertyadvsearch .form-control {
    background: #1e1e1e;
    border-color: #555;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch .price-values,
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch .price-values,
.dark-mode .aichat-manual-search #ospropertyadvsearch .price-values {
    color: #888;
}

[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch .searchbtns .btn-reset,
[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch .searchbtns .btn-save,
[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch .searchbtns .btn-update,
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch .searchbtns .btn-reset,
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch .searchbtns .btn-save,
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch .searchbtns .btn-update,
.dark-mode .aichat-manual-search #ospropertyadvsearch .searchbtns .btn-reset,
.dark-mode .aichat-manual-search #ospropertyadvsearch .searchbtns .btn-save,
.dark-mode .aichat-manual-search #ospropertyadvsearch .searchbtns .btn-update {
    background: #333;
    color: #ccc;
}

[data-bs-theme="dark"] .aichat-manual-search #ospropertyadvsearch .searchbtns,
[data-theme="dark"] .aichat-manual-search #ospropertyadvsearch .searchbtns,
.dark-mode .aichat-manual-search #ospropertyadvsearch .searchbtns {
    border-top-color: #444;
}

/* ── Loading & spinner ──────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-manual-loading,
[data-theme="dark"] .aichat-manual-loading,
.dark-mode .aichat-manual-loading {
    color: #888;
}

[data-bs-theme="dark"] .aichat-spinner,
[data-theme="dark"] .aichat-spinner,
.dark-mode .aichat-spinner {
    border-color: #444;
    border-top-color: var(--aichat-theme, #1a73e8);
}

/* ── Multiselect dropdown widget ────────────────────────────── */
[data-bs-theme="dark"] .aichat-ms-trigger,
[data-theme="dark"] .aichat-ms-trigger,
.dark-mode .aichat-ms-trigger {
    background-color: #1e1e1e;
    border-color: #555;
    color: #ccc;
}

[data-bs-theme="dark"] .aichat-ms-trigger.has-selection,
[data-theme="dark"] .aichat-ms-trigger.has-selection,
.dark-mode .aichat-ms-trigger.has-selection {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .aichat-ms-dropdown,
[data-theme="dark"] .aichat-ms-dropdown,
.dark-mode .aichat-ms-dropdown {
    background: #2a2a2a;
    border-color: #555;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .aichat-ms-item,
[data-theme="dark"] .aichat-ms-item,
.dark-mode .aichat-ms-item {
    color: #ccc;
    border-bottom-color: #444;
}

[data-bs-theme="dark"] .aichat-ms-item:hover,
[data-theme="dark"] .aichat-ms-item:hover,
.dark-mode .aichat-ms-item:hover {
    background: #2a3a4a;
}

/* ── Dropdown widget (.aichat-dropdown) ─────────────────────── */
[data-bs-theme="dark"] .aichat-dropdown-trigger,
[data-theme="dark"] .aichat-dropdown-trigger,
.dark-mode .aichat-dropdown-trigger {
    background-color: #1e1e1e;
    border-color: #555;
    color: #999;
}

[data-bs-theme="dark"] .aichat-dropdown-trigger.has-selection,
[data-theme="dark"] .aichat-dropdown-trigger.has-selection,
.dark-mode .aichat-dropdown-trigger.has-selection {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .aichat-dropdown-menu,
[data-theme="dark"] .aichat-dropdown-menu,
.dark-mode .aichat-dropdown-menu {
    background: #2a2a2a;
    border-color: #555;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .aichat-dropdown-item,
[data-theme="dark"] .aichat-dropdown-item,
.dark-mode .aichat-dropdown-item {
    color: #ccc;
    border-bottom-color: #444;
}

[data-bs-theme="dark"] .aichat-dropdown-item:hover,
[data-theme="dark"] .aichat-dropdown-item:hover,
.dark-mode .aichat-dropdown-item:hover {
    background: #2a3a4a;
}

/* ── Legacy custom multi-select (OS Property native) ────────── */
[data-bs-theme="dark"] .aichat-manual-search .custom-multi-select .selected-items,
[data-theme="dark"] .aichat-manual-search .custom-multi-select .selected-items,
.dark-mode .aichat-manual-search .custom-multi-select .selected-items {
    background-color: #1e1e1e;
    border-color: #555;
    color: #999;
}

[data-bs-theme="dark"] .aichat-manual-search .custom-multi-select .dropdown-content,
[data-theme="dark"] .aichat-manual-search .custom-multi-select .dropdown-content,
.dark-mode .aichat-manual-search .custom-multi-select .dropdown-content {
    background: #2a2a2a;
    border-color: #555;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .aichat-manual-search .custom-multi-select .dropdown-content label:hover,
[data-theme="dark"] .aichat-manual-search .custom-multi-select .dropdown-content label:hover,
.dark-mode .aichat-manual-search .custom-multi-select .dropdown-content label:hover {
    background: #2a3a4a;
}

[data-bs-theme="dark"] .aichat-manual-search .dropdown-menu,
[data-theme="dark"] .aichat-manual-search .dropdown-menu,
.dark-mode .aichat-manual-search .dropdown-menu {
    background: #2a2a2a;
    border-color: #555;
}

/* ── Extra field groups ─────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-extra-group-title,
[data-theme="dark"] .aichat-extra-group-title,
.dark-mode .aichat-extra-group-title {
    color: #888;
    border-bottom-color: #444;
}

[data-bs-theme="dark"] .amenity-count,
[data-theme="dark"] .amenity-count,
.dark-mode .amenity-count {
    color: #888;
}

[data-bs-theme="dark"] .amenity-count.zero,
[data-theme="dark"] .amenity-count.zero,
.dark-mode .amenity-count.zero {
    color: #555;
}

/* ── Context notice ─────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-context-notice,
[data-theme="dark"] .aichat-context-notice,
.dark-mode .aichat-context-notice {
    background: #1a2a3a;
    border-color: #2a4a6a;
    color: #ccc;
}

/* ── History panel ──────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-history-panel,
[data-theme="dark"] .aichat-history-panel,
.dark-mode .aichat-history-panel {
    background: rgba(30, 30, 30, 0.85);
    border-bottom-color: #444;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .aichat-history-loading,
[data-bs-theme="dark"] .aichat-history-empty,
[data-theme="dark"] .aichat-history-loading,
[data-theme="dark"] .aichat-history-empty,
.dark-mode .aichat-history-loading,
.dark-mode .aichat-history-empty {
    color: #888;
}

[data-bs-theme="dark"] .aichat-history-item,
[data-theme="dark"] .aichat-history-item,
.dark-mode .aichat-history-item {
    border-bottom-color: #444;
}

[data-bs-theme="dark"] .aichat-history-item:hover,
[data-theme="dark"] .aichat-history-item:hover,
.dark-mode .aichat-history-item:hover {
    background: #2a3a4a;
}

[data-bs-theme="dark"] .aichat-history-item.active,
[data-theme="dark"] .aichat-history-item.active,
.dark-mode .aichat-history-item.active {
    background: #1a2a3a;
}

[data-bs-theme="dark"] .aichat-history-title,
[data-theme="dark"] .aichat-history-title,
.dark-mode .aichat-history-title {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .aichat-history-meta,
[data-theme="dark"] .aichat-history-meta,
.dark-mode .aichat-history-meta {
    color: #888;
}

[data-bs-theme="dark"] .aichat-history-delete,
[data-theme="dark"] .aichat-history-delete,
.dark-mode .aichat-history-delete {
    color: #555;
}

[data-bs-theme="dark"] .aichat-history-delete:hover,
[data-theme="dark"] .aichat-history-delete:hover,
.dark-mode .aichat-history-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* History tabs */
[data-bs-theme="dark"] .aichat-history-tabs,
[data-theme="dark"] .aichat-history-tabs,
.dark-mode .aichat-history-tabs {
    border-bottom-color: #444;
    background: rgba(30, 30, 30, 0.6);
}

[data-bs-theme="dark"] .aichat-history-tab,
[data-theme="dark"] .aichat-history-tab,
.dark-mode .aichat-history-tab {
    color: #888;
}

[data-bs-theme="dark"] .aichat-history-tab:hover,
[data-theme="dark"] .aichat-history-tab:hover,
.dark-mode .aichat-history-tab:hover {
    color: #e0e0e0;
    background: rgba(26, 115, 232, 0.1);
}

/* History badge */
[data-bs-theme="dark"] .aichat-history-badge,
[data-theme="dark"] .aichat-history-badge,
.dark-mode .aichat-history-badge {
    background: #1a2a3a;
}

[data-bs-theme="dark"] .aichat-history-badge.zero,
[data-theme="dark"] .aichat-history-badge.zero,
.dark-mode .aichat-history-badge.zero {
    background: #333;
    color: #888;
}

/* ── Chat bubbles ───────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-message--bot .aichat-bubble,
[data-theme="dark"] .aichat-message--bot .aichat-bubble,
.dark-mode .aichat-message--bot .aichat-bubble {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

[data-bs-theme="dark"] .aichat-bubble strong,
[data-theme="dark"] .aichat-bubble strong,
.dark-mode .aichat-bubble strong {
    color: #e0e0e0;
}

/* ── Headings in responses ──────────────────────────────────── */
[data-bs-theme="dark"] .aichat-heading,
[data-theme="dark"] .aichat-heading,
.dark-mode .aichat-heading {
    color: #e0e0e0;
}

/* ── Source/reference labels ────────────────────────────────── */
[data-bs-theme="dark"] .aichat-source-label,
[data-theme="dark"] .aichat-source-label,
.dark-mode .aichat-source-label {
    color: #ccc;
}

/* ── Inline link pills ──────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-link,
[data-theme="dark"] .aichat-link,
.dark-mode .aichat-link {
    background: #1a2a3a;
    border-color: rgba(26, 115, 232, 0.3);
}

/* ── Tier labels ────────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-tier-label,
[data-theme="dark"] .aichat-tier-label,
.dark-mode .aichat-tier-label {
    background: #444;
    color: #ccc;
}

/* ── Property result cards ──────────────────────────────────── */
[data-bs-theme="dark"] .aichat-property-card,
[data-theme="dark"] .aichat-property-card,
.dark-mode .aichat-property-card {
    background: #2a2a2a;
    border-color: #444;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .aichat-property-card:hover,
[data-theme="dark"] .aichat-property-card:hover,
.dark-mode .aichat-property-card:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .aichat-property-card h5,
[data-theme="dark"] .aichat-property-card h5,
.dark-mode .aichat-property-card h5 {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .aichat-property-card .details,
[data-theme="dark"] .aichat-property-card .details,
.dark-mode .aichat-property-card .details {
    color: #888;
}

[data-bs-theme="dark"] .aichat-property-card .details.specs,
[data-theme="dark"] .aichat-property-card .details.specs,
.dark-mode .aichat-property-card .details.specs {
    color: #ccc;
}

[data-bs-theme="dark"] .aichat-property-card .details.location,
[data-theme="dark"] .aichat-property-card .details.location,
.dark-mode .aichat-property-card .details.location {
    color: #888;
}

/* Property card left panel (thumbnail area) */
[data-bs-theme="dark"] .aichat-prop-left,
[data-theme="dark"] .aichat-prop-left,
.dark-mode .aichat-prop-left {
    background: #333;
}

[data-bs-theme="dark"] .aichat-prop-thumb,
[data-theme="dark"] .aichat-prop-thumb,
.dark-mode .aichat-prop-thumb {
    background: #2a2a2a;
}

/* Property ID & type tags */
[data-bs-theme="dark"] .aichat-prop-id,
[data-theme="dark"] .aichat-prop-id,
.dark-mode .aichat-prop-id {
    background: #444;
    color: #ccc;
}

[data-bs-theme="dark"] .aichat-prop-type,
[data-theme="dark"] .aichat-prop-type,
.dark-mode .aichat-prop-type {
    background: #1e3a5a;
    color: #7cb3f0;
}

/* ── Source cards ────────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-source-card,
[data-theme="dark"] .aichat-source-card,
.dark-mode .aichat-source-card {
    background: #2a2a2a;
    border-color: #444;
}

[data-bs-theme="dark"] .aichat-source-card-header:hover,
[data-theme="dark"] .aichat-source-card-header:hover,
.dark-mode .aichat-source-card-header:hover {
    background: #333;
}

[data-bs-theme="dark"] .aichat-source-site,
[data-theme="dark"] .aichat-source-site,
.dark-mode .aichat-source-site {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .aichat-source-count,
[data-theme="dark"] .aichat-source-count,
.dark-mode .aichat-source-count {
    color: #888;
}

[data-bs-theme="dark"] .aichat-source-toggle,
[data-theme="dark"] .aichat-source-toggle,
.dark-mode .aichat-source-toggle {
    color: #888;
}

[data-bs-theme="dark"] .aichat-source-toggle:hover,
[data-theme="dark"] .aichat-source-toggle:hover,
.dark-mode .aichat-source-toggle:hover {
    color: #ccc;
}

/* Source reference pills */
[data-bs-theme="dark"] .aichat-source-ref,
[data-theme="dark"] .aichat-source-ref,
.dark-mode .aichat-source-ref {
    background: #1a2a3a;
    border-color: #2a4a6a;
}

[data-bs-theme="dark"] .aichat-sources-header,
[data-theme="dark"] .aichat-sources-header,
.dark-mode .aichat-sources-header {
    color: #ccc;
}

/* ── Nearby amenities/attractions cards ─────────────────────── */
[data-bs-theme="dark"] .aichat-amenity-card,
[data-theme="dark"] .aichat-amenity-card,
.dark-mode .aichat-amenity-card {
    background: #1a2a3a;
    border-color: #2a4a6a;
}

[data-bs-theme="dark"] .aichat-amenity-card h5,
[data-theme="dark"] .aichat-amenity-card h5,
.dark-mode .aichat-amenity-card h5 {
    color: #e0e0e0;
}

[data-bs-theme="dark"] .aichat-amenity-header,
[data-theme="dark"] .aichat-amenity-header,
.dark-mode .aichat-amenity-header {
    color: #ccc;
}

[data-bs-theme="dark"] .aichat-amenity-distance,
[data-theme="dark"] .aichat-amenity-distance,
.dark-mode .aichat-amenity-distance {
    color: #888;
}

[data-bs-theme="dark"] .aichat-amenity-section strong,
[data-theme="dark"] .aichat-amenity-section strong,
.dark-mode .aichat-amenity-section strong {
    color: #999;
}

[data-bs-theme="dark"] .aichat-amenity-section li,
[data-theme="dark"] .aichat-amenity-section li,
.dark-mode .aichat-amenity-section li {
    color: #ccc;
}

/* ── Input area ─────────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-input-area,
[data-theme="dark"] .aichat-input-area,
.dark-mode .aichat-input-area {
    background: rgba(30, 30, 30, 0.85);
    border-top-color: #444;
}

[data-bs-theme="dark"] .aichat-input,
[data-theme="dark"] .aichat-input,
.dark-mode .aichat-input {
    background: #1e1e1e;
    border-color: #555;
    color: #e0e0e0;
}

[data-bs-theme="dark"] .aichat-input:focus,
[data-theme="dark"] .aichat-input:focus,
.dark-mode .aichat-input:focus {
    background: #252525;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

[data-bs-theme="dark"] .aichat-send-btn,
[data-theme="dark"] .aichat-send-btn,
.dark-mode .aichat-send-btn {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ── Revision label ─────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-revision-label,
[data-theme="dark"] .aichat-revision-label,
.dark-mode .aichat-revision-label {
    color: #666;
}

/* ── Account info ───────────────────────────────────────────── */
[data-bs-theme="dark"] .aichat-account-info,
[data-theme="dark"] .aichat-account-info,
.dark-mode .aichat-account-info {
    background: #1a2a3a;
    border-color: #2a4a6a;
}

[data-bs-theme="dark"] .aichat-account-info .label,
[data-theme="dark"] .aichat-account-info .label,
.dark-mode .aichat-account-info .label {
    color: #ccc;
}

[data-bs-theme="dark"] .aichat-account-info .value,
[data-theme="dark"] .aichat-account-info .value,
.dark-mode .aichat-account-info .value {
    color: #999;
}

/* ── Property spec header ───────────────────────────────────── */
[data-bs-theme="dark"] .aichat-spec-header,
[data-theme="dark"] .aichat-spec-header,
.dark-mode .aichat-spec-header {
    border-top-color: #444;
}

[data-bs-theme="dark"] .aichat-spec-header strong,
[data-theme="dark"] .aichat-spec-header strong,
.dark-mode .aichat-spec-header strong {
    color: #e0e0e0;
}

/* ── Block caption in field groups ──────────────────────────── */
[data-bs-theme="dark"] .aichat-manual-search .field-group .block_caption,
[data-theme="dark"] .aichat-manual-search .field-group .block_caption,
.dark-mode .aichat-manual-search .field-group .block_caption {
    color: #ccc;
}

/* ── Resize handle hover ───────────────────────────────────── */
[data-bs-theme="dark"] .aichat-resize-handle:hover,
[data-bs-theme="dark"] .aichat-resize-handle.active,
[data-theme="dark"] .aichat-resize-handle:hover,
[data-theme="dark"] .aichat-resize-handle.active,
.dark-mode .aichat-resize-handle:hover,
.dark-mode .aichat-resize-handle.active {
    background: rgba(26, 115, 232, 0.4);
}
