/* Workspace layout — three-zone shell, minimal mode, drawers */

.app-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr var(--insights-width);
    width: 100%;
    height: 100vh;
    transition: grid-template-columns 0.3s ease;
    background: var(--bg-primary);
}

.app-container.left-collapsed {
    grid-template-columns: 0px 1fr var(--insights-width);
}

.app-container.right-collapsed {
    grid-template-columns: var(--sidebar-width) 1fr 0px;
}

.app-container.left-collapsed.right-collapsed {
    grid-template-columns: 0px 1fr 0px;
}

.app-container.minimal-mode {
    grid-template-columns: var(--rail-width) 1fr 0px;
}

.app-container.minimal-mode.left-collapsed {
    grid-template-columns: var(--rail-width) 1fr 0px;
}

.workspace-center {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-primary);
}

.workspace-scroll {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.workspace-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 8px;
}

.chat-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin: 16px 20px 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.app-topbar-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-new-search {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: var(--radius-pill);
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-new-search:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.btn-new-search-compact {
    padding: 5px 10px;
    font-size: 11px;
}

.btn-new-search-icon {
    font-size: 15px;
    line-height: 1;
}

.sidebar-content-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 16px 24px;
    -webkit-overflow-scrolling: touch;
}

.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.sidebar-section {
    margin-top: 18px;
}

.sidebar-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-left: 2px;
}

.sidebar-recent-section {
    margin-top: 12px;
}

.sidebar-recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.sessions-list-compact {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
}

.sessions-empty-hint {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 0;
}

.session-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.session-chip:hover:not(.active) {
    border-color: rgba(37, 99, 235, 0.35);
    background: var(--color-primary-light);
}

.session-chip-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.session-msg-badge {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-primary);
    font-size: 10px;
    font-weight: 600;
}

.session-chip.active .session-msg-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.session-chip.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.session-chip.active .session-chip-preview {
    color: #fff;
}

.session-chip.active .session-chip-meta {
    color: rgba(255, 255, 255, 0.75);
}

.session-chip-preview {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.session-chip-meta {
    font-size: 10px;
    color: var(--text-muted);
}

.criteria-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.criteria-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.criteria-edit-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 4px 8px;
    border-radius: 8px;
}

.criteria-edit-link:hover {
    background: var(--color-primary-light);
}

.criteria-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

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

.criteria-row-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.criteria-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    font-size: 14px;
    flex-shrink: 0;
}

.criteria-icon-badge {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.criteria-icon-badge--location { background: var(--icon-bg-location); color: var(--icon-fg-location); }
.criteria-icon-badge--type { background: var(--icon-bg-type); color: var(--icon-fg-type); }
.criteria-icon-badge--beds { background: var(--icon-bg-beds); color: var(--icon-fg-beds); }
.criteria-icon-badge--budget { background: var(--icon-bg-budget); color: var(--icon-fg-budget); }
.criteria-icon-badge--intent { background: var(--icon-bg-intent); color: var(--icon-fg-intent); }

.criteria-label {
    color: var(--text-muted);
    font-size: 12px;
}

.criteria-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    flex-shrink: 0;
    max-width: 55%;
}

.criteria-row.is-muted .criteria-value {
    color: var(--text-muted);
    font-weight: 500;
}

.property-results-section {
    margin: 12px 20px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.property-results-section.is-hidden {
    display: none;
}

.property-results-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.property-results-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.property-results-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.property-results-subtitle {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}

.property-results-count {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
}

.property-results-view-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.property-results-view-all:hover {
    background: var(--color-primary-light);
    border-color: rgba(37, 99, 235, 0.3);
}

.property-cards-scroll {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(260px, 280px);
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: rgba(100, 116, 139, 0.35) transparent;
}

.property-cards-scroll::-webkit-scrollbar {
    height: 6px;
}

.property-cards-scroll::-webkit-scrollbar-track {
    background: transparent;
    border-radius: var(--radius-pill);
}

.property-cards-scroll::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.35);
    border-radius: var(--radius-pill);
}

.property-cards-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.55);
}

.property-card {
    scroll-snap-align: start;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.property-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.property-card-image {
    height: 168px;
    background: var(--image-placeholder-gradient);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .property-card-image {
    background: linear-gradient(145deg, #1E293B 0%, #334155 100%);
}

.property-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.property-card-image-fallback {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    background: linear-gradient(160deg, rgba(239, 246, 255, 0.95) 0%, rgba(226, 232, 240, 0.85) 100%);
}

.property-card-image-badge {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(37, 99, 235, 0.12);
    color: var(--color-primary);
}

.property-card-image-icon {
    opacity: 0.7;
}

.property-card-image-label {
    font-size: 12px;
    font-weight: 500;
}

.property-card-body { padding: 14px 16px 16px; }

.property-card-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.property-card-type {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    margin-bottom: 10px;
}

.property-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.property-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.property-card-location {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.property-results-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.property-page-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.property-page-btn:hover:not(:disabled) {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.property-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.property-page-info {
    font-size: 13px;
    color: var(--text-secondary);
}

.property-page-muted {
    color: var(--text-muted);
}

/* Property Results drawer — vertical scroll list with sticky pagination */
.results-drawer-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.results-drawer-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.results-drawer-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.results-drawer-page {
    font-size: 12px;
    color: var(--text-muted);
}

.results-drawer-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 20px;
    -webkit-overflow-scrolling: touch;
}

.results-drawer-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.results-drawer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}

.results-drawer-footer {
    flex-shrink: 0;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.results-drawer-footer .property-results-pagination {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.results-drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    padding: 32px 24px;
    text-align: center;
}

#drawer-results .match-card--compact {
    max-width: none;
}

.property-results-empty {
    text-align: center;
    padding: 28px 16px;
}

.property-results-empty-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    color: var(--color-primary);
    opacity: 0.7;
}

.property-results-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.property-results-empty-text {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 320px;
    margin: 0 auto;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.28);
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.drawer-overlay.drawer-left {
    justify-content: flex-start;
}

.drawer-panel {
    width: min(480px, 100vw);
    height: 100%;
    max-height: 100vh;
    background: var(--bg-secondary);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drawer-overlay.open .drawer-panel {
    transform: translateX(0);
}

.drawer-overlay.drawer-left .drawer-panel {
    transform: translateX(-100%);
    border-right: 1px solid var(--border-color);
}

.drawer-panel.drawer-wide {
    width: min(560px, 95vw);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.drawer-title {
    font-size: 17px;
    font-weight: 600;
}

.drawer-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.drawer-subtitle {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 1.4;
}

.drawer-body--padded {
    padding: 16px 20px 24px;
}

.drawer-body--flush {
    padding: 0;
}

.drawer-results-panel {
    width: min(640px, 96vw);
}

.drawer-library-panel {
    width: min(520px, 96vw);
}

.drawer-replay-panel {
    width: min(600px, 96vw) !important;
}

.drawer-close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

/* AI Insights drawer — scrollable layout */
.drawer-insights-panel {
    width: min(480px, 96vw) !important;
}

.insights-drawer-inner {
    display: flex;
    flex-direction: column;
    min-height: min-content;
}

.insights-summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 16px 16px 8px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.insights-summary-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    text-align: center;
}

.insights-summary-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
}

.insights-summary-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.insights-accordion {
    padding: 8px 16px 24px;
}

.insights-acc-section {
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-card);
}

.insights-acc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.insights-acc-header:hover {
    background: var(--bg-tertiary);
}

.insights-acc-chevron {
    font-size: 11px;
    color: var(--text-muted);
}

.insights-acc-section:not(.is-open) .insights-acc-body {
    display: none;
}

.insights-acc-body {
    padding: 0 14px 14px;
    border-top: 1px solid var(--border-color);
}

.insights-ds-group {
    margin-bottom: 12px;
}

.insights-ds-group-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.insights-timing-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
}

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

.insights-timing-label { color: var(--text-primary); font-weight: 500; }
.insights-timing-meta { color: var(--text-muted); white-space: nowrap; }

.insights-raw-code {
    max-height: 280px;
    margin: 0;
}

.insights-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 8px;
}

@media (max-width: 768px) {
    .drawer-insights-panel,
    .drawer-panel.drawer-wide {
        width: 100vw !important;
        max-width: 100vw;
    }

    .insights-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .btn-new-search span:not(.btn-new-search-icon) {
        display: none;
    }

    .property-cards-scroll {
        grid-auto-columns: minmax(240px, 85vw);
    }
}

@media (max-width: 1024px) {
    .workspace-body {
        overflow-y: auto;
    }

    .chat-card {
        min-height: 55vh;
    }
}

.minimal-mode .chat-card {
    margin: 12px 16px 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.app-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.compact-journey-pill,
.compact-search-pill {
    display: none;
}

.minimal-mode .compact-journey-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--color-primary-light);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    color: var(--color-primary);
    cursor: pointer;
}

.minimal-mode .compact-search-pill {
    display: inline-block;
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
}

.mode-toggle.active {
    background: var(--color-primary-light);
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--color-primary);
}

.mode-toggle-track {
    width: 32px;
    height: 18px;
    border-radius: var(--radius-pill);
    background: var(--border-color);
    position: relative;
}

.mode-toggle.active .mode-toggle-track {
    background: var(--color-primary);
}

.mode-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.mode-toggle.active .mode-toggle-thumb {
    transform: translateX(14px);
}

.more-menu-wrap { position: relative; }

.more-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    z-index: 200;
}

.more-menu-dropdown.open { display: block; }

.more-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    background: transparent;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.more-menu-item:hover { background: var(--bg-tertiary); }
.more-menu-item.danger { color: #EF4444; }

.more-menu-divider {
    height: 1px;
    margin: 4px 8px;
    background: var(--border-color);
}

.more-menu-item-muted {
    color: var(--text-secondary);
    font-size: 12px;
}

.more-menu-item-logout {
    color: #B91C1C;
    font-size: 12px;
}

.btn-search-history {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-search-history:hover {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-color: #CBD5E1;
}

.search-history-link {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 0;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
}

.search-history-link:hover {
    color: var(--color-primary);
}

.sidebar-journey-section {
    margin-top: 12px;
}

.sidebar-journey-section .sidebar-section-title {
    margin-bottom: 6px;
    font-size: 11px;
}

.journey-list-compact .journey-list-item {
    padding: 6px 8px;
    font-size: 12px;
    gap: 8px;
}

.journey-list-compact .journey-list-icon {
    width: 20px;
    height: 20px;
    font-size: 10px;
}

.sessions-list-hidden {
    display: none !important;
}

.sessions-list-drawer {
    padding: 12px 16px 20px;
    max-height: none;
    overflow-y: auto;
    flex: 1;
}

.history-session-card {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    overflow: hidden;
}

.history-session-card.active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.15);
}

.history-session-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
}

.history-session-card.active .history-session-main {
    background: rgba(37, 99, 235, 0.06);
}

.history-session-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

.history-session-preview {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.history-session-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.history-session-delete {
    flex-shrink: 0;
    width: 40px;
    border: none;
    border-left: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
}

.history-session-delete:hover {
    background: rgba(239, 68, 68, 0.08);
    color: #EF4444;
}

.insights-empty-state {
    padding: 28px 20px 16px;
    text-align: center;
}

.insights-empty-icon {
    font-size: 28px;
    margin-bottom: 10px;
    opacity: 0.85;
}

.insights-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.insights-empty-text {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-muted);
    margin: 0;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.insights-summary-cards--idle {
    opacity: 0.65;
    padding-top: 8px;
}

.insights-summary-cards--idle .insights-summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.insights-summary-cards--active .insights-summary-value {
    color: var(--color-primary);
}

#insights-accordion {
    display: none;
}

#insights-accordion.insights-visible {
    display: block;
}

.journey-bar {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.journey-bar .wp-dot {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.journey-bar .wp-step.wp-completed .wp-dot {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}

.journey-bar .wp-step.wp-completed .wp-dot::after {
    content: '✓';
    font-size: 11px;
    font-weight: 700;
}

.journey-bar .wp-step.wp-active .wp-dot {
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.2);
}

.journey-bar .wp-step.wp-active .wp-label {
    color: var(--color-primary);
    font-weight: 600;
}

.sidebar-rail {
    display: none;
    flex-direction: column;
    align-items: center;
    padding: 16px 0;
    gap: 8px;
}

.minimal-mode .sidebar-rail { display: flex; }
.minimal-mode .sidebar-content-wrapper { display: none; }

.sidebar-rail-btn {
    width: 44px;
    height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar-rail-btn:hover {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.logo-icon {
    background: linear-gradient(135deg, var(--color-primary), var(--color-indigo)) !important;
}

.sidebar-user-card {
    margin: 16px 0 4px;
    padding: 12px 14px;
    background: var(--card-shine-gradient);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.sidebar-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-indigo));
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.sidebar-user-meta {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.status-chip::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #10B981;
    margin-right: 5px;
}

.profile-progress-wrap {
    margin-top: 2px;
}

.profile-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.profile-progress-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.profile-progress-bar {
    height: 5px;
    background: #E2E8F0;
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.profile-progress-pct {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
}

.profile-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-indigo));
    border-radius: var(--radius-pill);
    transition: width 0.4s ease;
}

.journey-list { display: flex; flex-direction: column; gap: 4px; }

.journey-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.journey-list-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
}

.journey-list-item.completed { color: var(--text-secondary); }

.journey-list-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
}

.journey-list-item.active .journey-list-icon {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.journey-list-item.completed .journey-list-icon {
    background: var(--color-success);
    border-color: var(--color-success);
    color: #fff;
}

.criteria-card,
.next-action-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 14px 16px;
    margin-top: 14px;
}

.next-action-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.next-action-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
}

.btn-find-properties,
.btn-next-action {
    width: 100%;
    padding: 11px 16px;
    border: none;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.15s ease, transform 0.1s ease;
}

.btn-find-properties:hover,
.btn-next-action:hover {
    background: #1D4ED8;
}

.btn-find-properties.btn-find-ready,
.btn-next-action.btn-find-ready {
    background: var(--color-primary);
}

.next-action-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(79, 70, 229, 0.05));
    border-color: rgba(37, 99, 235, 0.18);
}

.buyer-friendly-missing {
    margin-top: 14px;
    padding-top: 4px;
}

#buyer-missing-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.buyer-missing-chip {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    margin: 0;
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--radius-pill);
    background: rgba(37, 99, 235, 0.06);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.buyer-missing-chip:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
}

.quick-action-btn {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    font-family: inherit;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
}

.sidebar-advanced-panel { display: none; }
.mode-workspace .sidebar-advanced-panel { display: block; }

.buyer-missing-item {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-bottom: 8px;
    font-size: 13px;
    border-left: 3px solid var(--color-indigo);
}

.insights-column {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
}

.insights-column.collapsed { padding: 0; overflow: hidden; }
.minimal-mode .insights-column { display: none; }

.ai-insights-teaser {
    background: var(--color-ai-bg);
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: var(--radius-card);
    padding: 20px;
}

.btn-open-insights {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(79, 70, 229, 0.3);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-indigo);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
}

.property-results-section {
    margin: 16px 20px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-card);
    padding: 20px;
}

.floating-dock {
    display: none;
    position: fixed;
    bottom: 24px;
    right: 24px;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
}

.minimal-mode .floating-dock { display: flex; }

.floating-dock-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    font-size: 20px;
}

.floating-dock-btn.primary {
    background: var(--color-primary);
    color: #fff;
}

.message .property-table-container { display: none; }

.message.assistant {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    max-width: 820px;
    width: 100%;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-avatar);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-cyan) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.message-avatar.chimny-avatar {
    margin-top: 2px;
}

.chimny-avatar-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chimny-avatar-inner .ui-icon {
    stroke: #fff;
}

.drawer-overlay.drawer-left { justify-content: flex-start; }

.drawer-overlay.drawer-left .drawer-panel {
    transform: translateX(-100%);
    border-right: 1px solid var(--border-color);
}

.drawer-overlay.drawer-left.open .drawer-panel {
    transform: translateX(0);
}

@media (max-width: 1200px) {
    .app-container:not(.minimal-mode) {
        grid-template-columns: 280px 1fr 0px;
    }
}

@media (max-width: 1024px) {
    .app-container { grid-template-columns: 1fr !important; }
    .sidebar { display: none; }
    .floating-dock { display: flex !important; }
}

/* Edit Search Criteria drawer */
.edit-criteria-intro {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    padding: 16px 16px 8px;
    margin: 0;
}

.edit-criteria-list {
    padding: 0 16px;
}

.edit-criteria-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 0;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: transparent;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

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

.edit-criteria-row:hover {
    background: var(--color-primary-light);
    margin: 0 -8px;
    padding-left: 8px;
    padding-right: 8px;
    border-radius: 10px;
}

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

.edit-criteria-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--bg-tertiary);
    font-size: 14px;
    flex-shrink: 0;
}

.edit-criteria-label {
    font-size: 12px;
    color: var(--text-muted);
}

.edit-criteria-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 45%;
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edit-criteria-row.is-empty .edit-criteria-value {
    color: var(--text-muted);
    font-weight: 500;
}

.edit-criteria-action {
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
}

.edit-criteria-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
}

.btn-edit-criteria-chat {
    width: 100%;
    padding: 12px;
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: var(--radius-pill);
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-edit-criteria-chat:hover {
    background: var(--color-primary);
    color: #fff;
}

/* Buyer profile drawer */
.buyer-profile-panel {
    padding: 8px 16px 24px;
}

.buyer-profile-section {
    margin-bottom: 20px;
}

.buyer-profile-heading {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.buyer-profile-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

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

.buyer-profile-label {
    color: var(--text-muted);
    font-size: 12px;
    flex-shrink: 0;
}

.buyer-profile-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    max-width: 60%;
}

.buyer-profile-row.is-muted .buyer-profile-value {
    color: var(--text-muted);
    font-weight: 500;
}

.buyer-profile-empty,
.buyer-profile-complete {
    font-size: 13px;
    color: var(--text-muted);
    padding: 8px 0;
}

.buyer-profile-complete {
    color: #059669;
}

.buyer-profile-badge {
    display: inline-flex;
    padding: 1px 8px;
    border-radius: var(--radius-pill);
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-primary);
    font-size: 11px;
    font-weight: 600;
    vertical-align: middle;
}

.buyer-profile-missing-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.journey-drawer-bar {
    flex-wrap: wrap;
    margin: 12px 16px 20px;
}

.advanced-profile-accordion {
    margin-top: 8px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.advanced-profile-summary {
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    background: var(--bg-tertiary);
    list-style: none;
}

.advanced-profile-summary::-webkit-details-marker { display: none; }

.advanced-profile-body {
    padding: 12px 14px;
    font-size: 12px;
}

.advanced-profile-section {
    margin-bottom: 14px;
}

.advanced-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.advanced-profile-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}

.advanced-profile-label { color: var(--text-muted); }
.advanced-profile-value { color: var(--text-primary); font-weight: 500; text-align: right; }

.advanced-missing-item {
    padding: 6px 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.profile-chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    font-size: 12px;
    color: var(--text-primary);
}

.drawer-recent-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.drawer-recent-toolbar {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.sessions-list-drawer {
    padding: 12px 16px;
    max-height: none;
}

.drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.drawer-body .buyer-profile-panel .session-chip {
    width: 100%;
}

.drawer-insights-overlay .drawer-header {
    position: sticky;
    top: 0;
    z-index: 3;
}

.drawer-insights-overlay .drawer-body {
    display: flex;
    flex-direction: column;
}

.mri-empty {
    text-align: center;
    padding: 20px 12px;
    color: var(--text-muted);
    font-size: 13px;
    font-style: normal;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px dashed var(--border-color);
}

/* ===== Buyer Mode shell & layout ===== */

.buyer-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
    background: var(--bg-primary);
}

.buyer-shell .app-container {
    height: auto;
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* Buyer header */
.buyer-header {
    display: none;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 30;
}

.buyer-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

.buyer-header-left {
    flex: 0 0 auto;
    min-width: 0;
}

.buyer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.buyer-logo-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--color-primary-light);
    font-size: 18px;
}

.buyer-logo-text-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.buyer-logo-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.buyer-logo-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.2;
}

.buyer-header-center {
    flex: 1;
    display: flex;
    justify-content: center;
    min-width: 0;
}

.buyer-header-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.buyer-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.buyer-header-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.buyer-header-btn.icon-btn {
    padding: 8px 10px;
    font-size: 16px;
}

.saved-homes-btn {
    border-color: rgba(37, 99, 235, 0.2);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.saved-homes-icon {
    font-size: 14px;
}

.saved-homes-label {
    font-weight: 600;
}

.saved-homes-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.buyer-avatar-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease;
}

.buyer-avatar-btn:hover {
    border-color: var(--color-primary);
}

.mode-switch {
    display: none;
    align-items: center;
    gap: 2px;
    padding: 3px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    flex-shrink: 0;
}

body.is-admin .mode-switch {
    display: inline-flex;
}

.mode-switch-option {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.mode-switch-option:hover {
    color: var(--text-primary);
}

.mode-switch-option.is-active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.mode-switch-option:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Buyer journey stepper */
.buyer-journey {
    display: flex;
    align-items: center;
    gap: 0;
    flex-wrap: nowrap;
}

.bj-step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
}

.bj-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    color: transparent;
}

.bj-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
}

.bj-sep {
    width: 20px;
    height: 2px;
    background: var(--border-color);
    flex-shrink: 0;
}

.bj-sep-done {
    background: var(--color-success);
}

.bj-step.bj-active .bj-dot {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

.bj-step.bj-active .bj-label {
    color: var(--color-primary);
    font-weight: 600;
}

.bj-step.bj-completed .bj-dot {
    border-color: var(--color-success);
    background: var(--color-success);
    color: #fff;
}

.bj-step.bj-completed .bj-label {
    color: var(--text-secondary);
}

/* Journey drawer — vertical list */
.journey-drawer-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
}

.journey-drawer-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    position: relative;
}

.journey-drawer-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 9px;
    top: 30px;
    bottom: -2px;
    width: 2px;
    background: var(--border-color);
}

.journey-drawer-item.is-completed:not(:last-child)::after {
    background: var(--color-success);
}

.journey-drawer-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    color: transparent;
    z-index: 1;
}

.journey-drawer-item.is-active .journey-drawer-dot {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: #fff;
}

.journey-drawer-item.is-completed .journey-drawer-dot {
    border-color: var(--color-success);
    background: var(--color-success);
    color: #fff;
}

.journey-drawer-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    line-height: 20px;
    padding-top: 1px;
}

.journey-drawer-item.is-active .journey-drawer-label {
    color: var(--color-primary);
    font-weight: 600;
}

.journey-drawer-item.is-completed .journey-drawer-label {
    color: var(--text-secondary);
}

/* Search summary strip */
.search-summary-strip {
    display: none;
    flex-shrink: 0;
    padding: 12px 20px 0;
    background: var(--bg-primary);
}

.search-summary-card {
    max-width: 1440px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: var(--shadow-sm);
}

.search-summary-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    width: 100%;
}

.search-summary-criteria {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 0;
    min-width: 0;
    flex: 1;
}

.strip-divider {
    width: 1px;
    height: 16px;
    background: var(--border-color);
    margin: 0 12px;
    flex-shrink: 0;
}

.strip-criterion {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
}

.strip-criterion.is-muted .strip-value {
    color: var(--text-muted);
}

.strip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.strip-criterion .criteria-icon-badge {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
}

.strip-value {
    font-weight: 500;
}

.btn-edit-search {
    flex-shrink: 0;
    padding: 7px 16px;
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--color-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-edit-search:hover {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* Advisor workspace layout */
.decision-workspace {
    display: flex;
    gap: 16px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: visible;
}

.advisor-row {
    display: flex;
    gap: 16px;
    flex: 0 0 auto;
    min-height: 0;
    overflow: visible;
}

.advisor-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-composer {
    flex-shrink: 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    padding: 12px 16px;
}

.chat-composer .input-container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0;
    border-top: none;
    background: transparent;
}

.chat-composer .disclaimer {
    text-align: center;
    margin-top: 6px;
    font-size: 11px;
    padding: 0;
    border-top: none;
    background: transparent;
    color: var(--text-muted);
}

body.mode-buyer .chat-composer {
    padding: 12px 20px 14px;
}

.advisor-aside {
    display: none;
    flex: 0 0 300px;
    flex-direction: column;
    gap: 12px;
    padding: 16px 16px 16px 0;
    overflow-y: auto;
    min-height: 0;
}

.next-best-step-card,
.search-clarity-card,
.guidance-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
}

.next-best-step-card {
    background: var(--accent-surface-gradient);
    border-color: rgba(37, 99, 235, 0.15);
}

.search-clarity-card {
    background: var(--bg-card);
}

.guidance-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.next-action-text {
    font-size: 14px;
    line-height: 1.55;
    color: var(--text-secondary);
    margin: 0 0 14px;
}

.btn-next-action {
    display: block;
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-next-action:hover {
    background: var(--color-primary-dark);
}

.btn-next-action.btn-find-ready {
    background: var(--color-success);
}

.btn-next-action.btn-find-ready:hover {
    background: #059669;
}

.btn-skip-step {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.btn-skip-step:hover {
    color: var(--color-primary);
}

.clarity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.clarity-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.clarity-pct {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
}

.clarity-bar {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    overflow: hidden;
    margin-bottom: 8px;
}

.clarity-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--color-primary), var(--color-indigo));
    transition: width 0.3s ease;
}

.clarity-description {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    margin: 0;
}

.guidance-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.guidance-card-link {
    border: none;
    background: none;
    color: var(--color-primary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}

.guidance-card-link:hover {
    background: var(--color-primary-light);
}

.guidance-card-sub,
.guidance-empty-text {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.guidance-mini-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.guidance-profile-mini .guidance-mini-grid {
    margin-top: 2px;
}

.guidance-mini-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.guidance-mini-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.guidance-mini-row:first-child {
    padding-top: 0;
}

.guidance-mini-row .criteria-icon-badge {
    width: 30px;
    height: 30px;
    margin-top: 1px;
    flex-shrink: 0;
}

.guidance-mini-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.guidance-mini-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    line-height: 1.2;
}

.guidance-mini-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

.guidance-mini-row.is-muted .guidance-mini-value {
    color: var(--text-muted);
    font-weight: 500;
    font-style: italic;
}

.guidance-refine-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.guidance-refine-chip {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.12s ease;
}

.guidance-refine-chip:hover {
    border-color: rgba(37, 99, 235, 0.35);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.guidance-checklist-details {
    border: none;
}

.guidance-checklist-summary {
    cursor: pointer;
    list-style: none;
    margin-bottom: 0;
}

.guidance-checklist-summary::-webkit-details-marker {
    display: none;
}

.guidance-collapse-hint::after {
    content: '▾';
    font-size: 11px;
    color: var(--text-muted);
}

.guidance-checklist-details:not([open]) .guidance-collapse-hint::after {
    content: '▸';
}

.guidance-checklist-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.guidance-checklist-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.12s ease;
}

.guidance-checklist-item:hover {
    border-color: rgba(37, 99, 235, 0.2);
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.guidance-checklist-icon {
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--color-success);
    flex-shrink: 0;
}

.guidance-activity-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.12s ease;
}

.guidance-activity-btn:hover {
    border-color: rgba(37, 99, 235, 0.3);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

/* Profile journey timeline (drawer) */
.profile-journey-status {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin: 0 0 14px;
}

.profile-journey-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profile-journey-step {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 12px;
    align-items: start;
    min-height: 36px;
}

.profile-journey-track {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 28px;
}

.profile-journey-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: transparent;
}

.profile-journey-line {
    width: 2px;
    flex: 1;
    min-height: 14px;
    background: var(--border-color);
    margin: 4px 0;
}

.profile-journey-step--completed .profile-journey-dot {
    border-color: var(--color-success);
    background: var(--color-success);
    color: #fff;
}

.profile-journey-step--completed .profile-journey-line {
    background: var(--color-success);
}

.profile-journey-step--active .profile-journey-dot {
    border-color: var(--color-primary);
    background: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
}

.profile-journey-step--active .profile-journey-label {
    color: var(--color-primary);
    font-weight: 600;
}

.profile-journey-label {
    font-size: 13px;
    color: var(--text-muted);
    padding-top: 2px;
    line-height: 1.4;
}

.profile-journey-step--completed .profile-journey-label {
    color: var(--text-secondary);
}

.profile-journey--compact .profile-journey-status {
    font-size: 12px;
    margin-bottom: 12px;
}

/* Workspace insights — collapsed rail + floating access */
body.mode-workspace .insights-column {
    display: none !important;
}

.workspace-insights-fab {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 88px;
    z-index: 25;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 1px solid rgba(79, 70, 229, 0.25);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--color-indigo);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.15s ease;
}

.workspace-insights-fab:hover {
    background: var(--color-ai-bg);
    border-color: var(--color-indigo);
}

.workspace-insights-fab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#insights-quick-btn {
    color: var(--color-indigo);
    border: 1px solid rgba(79, 70, 229, 0.2);
    border-radius: var(--radius-sm);
}

#insights-quick-btn:hover {
    background: var(--color-ai-bg);
}

.privacy-note--compact {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
}

.privacy-note-icon {
    display: inline-flex;
    color: var(--text-muted);
}

.criteria-card {
    padding: 14px;
}

/* Mode visibility */
body.mode-buyer .buyer-header {
    display: block;
}

body.mode-buyer .search-summary-strip {
    display: block;
}

body.mode-buyer .buyer-action-chips {
    display: flex;
    position: absolute;
    bottom: 108px;
    right: 16px;
    left: auto;
    z-index: 10;
    align-items: flex-end;
}

body.mode-buyer .advisor-aside {
    display: none !important;
}

body.mode-buyer .advisor-aside--legacy {
    display: none !important;
}

body.mode-buyer .sidebar,
body.mode-buyer .insights-column,
body.mode-buyer .insights-column.collapsed {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

body.mode-buyer .app-container,
body.mode-buyer .app-container.right-collapsed,
body.mode-buyer .app-container.left-collapsed,
body.mode-buyer .app-container.left-collapsed.right-collapsed,
body.mode-buyer .app-container.minimal-mode {
    grid-template-columns: 1fr !important;
}

body.mode-buyer .workspace-center {
    width: 100%;
    max-width: 100%;
    height: auto;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

body.mode-buyer .app-topbar {
    display: none !important;
}

body.mode-buyer #workspace-progress {
    display: none !important;
}

body.mode-buyer .floating-dock {
    display: none !important;
}

body.mode-workspace .buyer-header,
body.mode-workspace .search-summary-strip,
body.mode-workspace .buyer-action-chips {
    display: none !important;
}

body.mode-workspace .advisor-aside {
    display: none !important;
}

body.mode-buyer .workspace-body {
    padding-bottom: 0;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

body.mode-buyer .decision-workspace {
    flex: 1;
    min-height: 0;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    gap: 20px;
    padding: 12px 20px 16px;
    align-items: stretch;
}

body.mode-buyer .decision-chat-column {
    flex: 1 1 64%;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

body.mode-buyer .matches-rail {
    flex: 0 0 36%;
    min-width: 300px;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    position: sticky;
    top: 0;
    align-self: flex-start;
    max-height: calc(100vh - var(--buyer-chrome-offset));
}

.context-rail {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.context-rail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 16px 10px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}

.context-rail-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.context-rail-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.context-rail-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
}

.context-rail-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px 16px;
    -webkit-overflow-scrolling: touch;
}

.context-rail-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.context-rail-progress {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.context-rail-progress-bar {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    overflow: hidden;
}

.context-rail-progress-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--color-primary), var(--color-indigo));
    transition: width 0.3s ease;
}

.context-rail-checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.context-rail-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.context-rail-check-row.is-done {
    border-color: rgba(5, 150, 105, 0.2);
    background: rgba(236, 253, 245, 0.5);
}

.context-rail-check-row.is-needed {
    border-style: dashed;
}

.context-rail-check-icon {
    width: 18px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.context-rail-check-row.is-done .context-rail-check-icon {
    color: var(--color-success, #059669);
}

.context-rail-check-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.context-rail-check-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.context-rail-check-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context-rail-check-needed {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.context-rail-next-prompt {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-primary);
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--accent-surface-gradient);
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.context-rail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.context-rail-chip {
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.context-rail-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.context-rail-placeholder {
    margin-top: 4px;
    padding: 20px 14px;
    border-radius: 14px;
    border: 1px dashed var(--border-color);
    background: var(--bg-primary);
    text-align: center;
    color: var(--text-muted);
}

.context-rail-placeholder-icon {
    display: block;
    font-size: 22px;
    margin-bottom: 8px;
    opacity: 0.65;
}

.context-rail-placeholder p {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
}

.context-rail-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.context-rail-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.context-rail-sub {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0;
}

.context-rail-status {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0;
}

.context-rail-cta-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.context-rail-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease;
}

.context-rail-cta--primary {
    background: var(--color-primary);
    color: #fff;
}

.context-rail-cta--primary:hover {
    background: var(--color-primary-dark);
}

.context-rail-cta--secondary {
    background: var(--bg-card);
    color: var(--color-primary);
    border: 1px solid rgba(37, 99, 235, 0.25);
}

.context-rail-cta--secondary:hover {
    background: var(--color-primary-light);
}

.context-rail-cta--ghost {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid transparent;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.context-rail-cta--block {
    width: 100%;
}

.context-rail-skeleton {
    display: grid;
    grid-template-columns: 72px 1fr;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-card);
}

.context-rail-skeleton-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, #E2E8F0 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: context-rail-shimmer 1.2s infinite;
}

.context-rail-skeleton-lines {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 6px;
}

.context-rail-skeleton-line {
    height: 10px;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, #E2E8F0 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: context-rail-shimmer 1.2s infinite;
}

.context-rail-skeleton-line--short { width: 45%; }
.context-rail-skeleton-line--medium { width: 72%; }

@keyframes context-rail-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.context-rail-guidance-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-primary);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.context-rail-guidance-card:hover {
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: var(--shadow-sm);
}

.context-rail-guidance-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.context-rail-guidance-body {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
}

.context-rail-refine {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.matches-rail[data-rail-state="setup"] .context-rail-view-all,
.matches-rail[data-rail-state="ready"] .context-rail-view-all,
.matches-rail[data-rail-state="searching"] .context-rail-view-all,
.matches-rail[data-rail-state="no_results"] .context-rail-view-all,
.matches-rail[data-rail-state="guidance"] .context-rail-view-all {
    display: none !important;
}

body.mode-buyer .advisor-row.decision-workspace {
    align-items: stretch;
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
}

.advisor-main .chat-card {
    flex: 0 0 auto;
}

body.mode-buyer .advisor-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

body.mode-buyer .advisor-main .chat-card {
    margin: 0;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    height: calc(100vh - var(--buyer-chrome-offset) - 24px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

body.mode-buyer .property-results-section {
    width: 100%;
    max-width: none;
    margin: 0;
    align-self: stretch;
    min-width: 0;
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding: 16px 16px 12px;
    border-radius: 20px;
}

body.mode-buyer .property-results-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

body.mode-buyer .property-results-header {
    margin-bottom: 12px;
    flex-shrink: 0;
}

body.mode-buyer .property-results-title {
    font-size: 16px;
}

body.mode-buyer .property-results-subtitle {
    font-size: 12px;
    margin-top: 2px;
}

body.mode-buyer .property-results-view-all {
    padding: 6px 12px;
    font-size: 12px;
}

body.mode-buyer .message.assistant .message-content-wrap {
    max-width: 820px;
}

body.mode-buyer .message.assistant .message-bubble {
    line-height: 1.65;
}

/* Buyer quick-action chips — buyer mode only */
.buyer-action-chips {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 25;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.buyer-action-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    white-space: nowrap;
    transition:
        width 0.2s ease,
        padding 0.2s ease,
        gap 0.2s ease,
        border-color 0.15s ease,
        color 0.15s ease,
        background 0.15s ease;
}

.buyer-action-chip:hover,
.buyer-action-chip:focus-visible {
    width: auto;
    max-width: 240px;
    height: auto;
    min-height: 44px;
    padding: 10px 16px;
    gap: 8px;
    justify-content: flex-start;
    outline: none;
}

.buyer-action-chip:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.buyer-action-chip:focus-visible {
    border-color: var(--color-primary);
    color: var(--color-primary);
    box-shadow: var(--shadow-md), 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.buyer-action-chip--reset {
    background: #FEF2F2;
    border-color: rgba(239, 68, 68, 0.22);
    color: #B91C1C;
}

.buyer-action-chip--reset:hover,
.buyer-action-chip--reset:focus-visible {
    background: #FEE2E2;
    border-color: rgba(239, 68, 68, 0.4);
    color: #991B1B;
    box-shadow: var(--shadow-md);
}

.buyer-action-chip--reset:focus-visible {
    box-shadow: var(--shadow-md), 0 0 0 2px rgba(239, 68, 68, 0.25);
}

.buyer-action-chip--reset .buyer-action-chip-icon {
    color: #DC2626;
}

.buyer-action-chip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    font-size: 15px;
}

.buyer-action-chip:hover .buyer-action-chip-icon,
.buyer-action-chip:focus-visible .buyer-action-chip-icon {
    width: auto;
    height: auto;
}

.buyer-action-chip-label {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width 0.2s ease, opacity 0.15s ease;
}

.buyer-action-chip:hover .buyer-action-chip-label,
.buyer-action-chip:focus-visible .buyer-action-chip-label {
    max-width: 180px;
    opacity: 1;
}

/* Responsive — Buyer Mode */
@media (max-width: 1100px) {
    .bj-label {
        display: none;
    }

    .bj-step.bj-active .bj-label {
        display: inline;
    }

    .advisor-aside {
        flex: 0 0 260px;
    }

    .saved-homes-label {
        display: none;
    }
}

@media (max-width: 900px) {
    .advisor-row {
        flex-direction: column;
        overflow-y: auto;
    }

    .advisor-aside {
        flex: 0 0 auto;
        flex-direction: row;
        padding: 0 16px 12px;
        overflow-x: auto;
    }

    .next-best-step-card,
    .search-clarity-card,
    .guidance-card {
        flex: 1;
        min-width: 240px;
    }

    .advisor-main .chat-card {
        min-height: 360px;
    }

    body.mode-buyer .advisor-main .chat-card {
        margin: 0;
    }

    body.mode-workspace .advisor-main .chat-card {
        margin: 12px 16px 0;
    }

    .buyer-header-center {
        order: 3;
        flex: 1 1 100%;
        justify-content: flex-start;
        overflow-x: auto;
        padding-top: 4px;
    }

    .buyer-header-inner {
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .buyer-header-inner {
        padding: 10px 12px;
        gap: 10px;
    }

    .search-summary-strip {
        padding: 8px 12px;
        overflow-x: auto;
    }

    .search-summary-criteria {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 2px;
    }

    .mode-switch-option {
        padding: 5px 10px;
        font-size: 11px;
    }

    .buyer-logo-subtitle {
        display: none;
    }
}

@media (max-width: 1024px) {
    body.mode-buyer .floating-dock {
        display: none !important;
    }

    body.mode-workspace .floating-dock {
        display: flex !important;
    }
}

/* ===== Buyer Mode polish pass ===== */

.ui-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
    color: currentColor;
}

.buyer-logo-icon {
    color: var(--color-primary);
}

.buyer-logo-icon .ui-icon {
    color: var(--color-primary);
}

.saved-homes-icon {
    display: inline-flex;
    color: var(--color-primary);
}

.strip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--color-primary);
    flex-shrink: 0;
}

.strip-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.strip-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    line-height: 1.2;
}

.strip-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.strip-criterion.is-muted .strip-value {
    color: var(--text-muted);
    font-weight: 500;
}

.more-menu-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.more-menu-label {
    flex: 1;
    min-width: 0;
}

.workspace-mode-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    background: rgba(79, 70, 229, 0.12);
    color: var(--color-indigo);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

body.mode-workspace .workspace-topbar {
    background: var(--workspace-topbar-gradient);
    border-bottom: 1px solid rgba(79, 70, 229, 0.2);
}

body.mode-workspace .app-container {
    outline: 1px solid rgba(79, 70, 229, 0.08);
    outline-offset: -1px;
}

/* Chat workspace balance — buyer mode */
body.mode-buyer .welcome-screen {
    flex: 1 1 auto;
    align-self: stretch;
    justify-content: flex-start;
    align-items: stretch;
    width: 100%;
    max-width: none;
    padding: 28px 24px 16px;
    margin-top: 0;
    text-align: center;
}

body.mode-buyer .welcome-screen-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

body.mode-buyer .welcome-icon {
    width: 56px;
    height: 56px;
    font-size: 0;
    margin-bottom: 16px;
    border-radius: 16px;
}

body.mode-buyer .welcome-title {
    font-size: 22px;
}

body.mode-buyer .welcome-subtitle {
    font-size: 15px;
    max-width: 480px;
}

.welcome-tips-label {
    margin-top: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.welcome-help-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 20px;
    max-width: 520px;
}

.welcome-help-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-secondary);
}

.welcome-help-icon {
    display: inline-flex;
    color: var(--color-primary);
}

.advisor-main .messages-container {
    flex: 0 0 auto;
    overflow: visible;
}

body.mode-buyer .messages-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    justify-content: flex-start;
    align-items: stretch;
    padding: 12px 20px 8px;
    gap: 12px;
}

body.mode-buyer .message.assistant {
    align-self: flex-start;
}

/* Next best step — aligned with chat */
body.mode-buyer .advisor-row {
    align-items: stretch;
}

body.mode-buyer .next-best-step-card,
body.mode-buyer .search-clarity-card,
body.mode-buyer .guidance-card {
    border-radius: 20px;
}

body.mode-buyer #next-best-step-card {
    display: none !important;
}

.guidance-card-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.next-action-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.btn-next-action {
    border-radius: 12px;
    padding: 9px 14px;
    font-size: 13px;
}

/* Inline next step under latest assistant reply */
.inline-next-step-prompt {
    margin-top: 10px;
    max-width: 100%;
}

.inline-next-step-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--accent-surface-gradient);
    border: 1px solid rgba(37, 99, 235, 0.18);
}

.inline-next-step-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-primary);
}

.inline-next-step-text {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-primary);
    margin: 0;
}

.inline-next-step-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    align-self: flex-start;
    padding: 7px 12px;
    border: none;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.inline-next-step-btn:hover {
    background: var(--color-primary-dark);
}

.inline-next-step-btn .ui-icon {
    color: #fff;
}

@media (max-width: 900px) {
    body.mode-buyer .decision-workspace {
        flex-direction: column;
        padding: 8px 16px 0;
    }

    body.mode-buyer .decision-chat-column {
        flex: 1 1 auto;
    }

    body.mode-buyer .advisor-main .chat-card {
        min-height: 360px;
        height: calc(100vh - var(--buyer-chrome-offset) - 120px);
    }

    body.mode-buyer .matches-rail {
        flex: 0 0 auto;
        min-width: 0;
        max-width: none;
        position: static;
        max-height: 320px;
    }

    .strip-value {
        max-width: 120px;
    }
}

@media (max-width: 640px) {
    .welcome-help-grid {
        flex-direction: column;
        align-items: stretch;
    }

    body.mode-buyer .welcome-screen {
        padding: 20px 16px 12px;
    }

    body.mode-buyer .messages-container {
        padding: 8px 12px 6px;
    }

    body.mode-buyer .buyer-action-chips {
        bottom: 100px;
        right: 12px;
    }
}

/* ===== Decision workspace — compact match cards ===== */

.matches-rail {
    display: none;
}

body.mode-workspace .matches-rail {
    display: block;
    order: 2;
    width: 100%;
}

body.mode-workspace .decision-workspace {
    flex-direction: column;
}

body.mode-workspace .context-rail {
    display: none;
}

body.mode-workspace .matches-rail {
    display: block;
    order: 2;
    width: 100%;
    max-width: none;
    position: static;
    max-height: none;
}

body.mode-workspace .property-results-section:not(.is-hidden) {
    display: block;
    margin: 0 20px 20px;
}

.match-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.match-card {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 10px;
    align-items: start;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.match-card:hover {
    border-color: rgba(37, 99, 235, 0.28);
    box-shadow: var(--shadow-md);
}

.match-card.is-selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.2), var(--shadow-md);
}

.match-card.is-compare {
    background: var(--accent-surface-gradient);
}

.match-card-thumb {
    position: relative;
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--image-placeholder-gradient);
    flex-shrink: 0;
}

.match-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.match-card-thumb .property-card-image-fallback {
    height: 72px;
    gap: 4px;
}

.match-card-thumb .property-card-image-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.match-card-thumb .property-card-image-label {
    display: none;
}

.match-card-save {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--color-primary);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.match-card-main {
    min-width: 0;
}

.match-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.match-card-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.match-card-badge {
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.match-card-address {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-card-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.match-card-fit {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-secondary);
}

.match-card-fit-icon {
    color: var(--color-success, #059669);
    font-weight: 700;
    flex-shrink: 0;
}

.match-card-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.match-card-action {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.match-card-action:hover,
.match-card-action.is-active {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.match-card-action--details {
    width: auto;
    min-width: 28px;
    padding: 0 8px;
    font-size: 10px;
    font-weight: 600;
}

.refine-matches-panel {
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-card);
    overflow: hidden;
}

.refine-matches-details {
    margin: 0;
}

.refine-matches-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    user-select: none;
}

.refine-matches-summary::-webkit-details-marker {
    display: none;
}

.refine-matches-summary-hint::after {
    content: '▾';
    font-size: 10px;
    color: var(--text-muted);
}

.refine-matches-details[open] .refine-matches-summary-hint::after {
    content: '▴';
}

.refine-matches-body {
    padding: 0 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.refine-matches-body .guidance-card {
    border: none;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    background: transparent;
}

.refine-matches-body .guidance-card-title {
    font-size: 10px;
    margin-bottom: 6px;
}

.refine-matches-body .guidance-refine-chip {
    font-size: 11px;
    padding: 5px 10px;
}

.guidance-checklist--compact .guidance-checklist-list {
    max-height: 120px;
    overflow-y: auto;
}

/* Mobile matches tab + bottom sheet */
.mobile-matches-tab {
    display: none;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 16px;
    z-index: 40;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--color-primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
}

.mobile-matches-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

body.matches-sheet-open .mobile-matches-tab {
    display: none;
}

@media (max-width: 768px) {
    body.mode-buyer .mobile-matches-tab {
        display: inline-flex;
    }

    body.mode-buyer .decision-workspace {
        padding-bottom: 72px;
    }

    body.mode-buyer .matches-rail {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 35;
        max-height: min(72vh, 560px);
        min-width: 0;
        border-radius: 20px 20px 0 0;
        background: var(--bg-primary);
        box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.15);
        transform: translateY(110%);
        transition: transform 0.28s ease;
        padding: 0 12px 12px;
        visibility: hidden;
        pointer-events: none;
    }

    body.mode-buyer .matches-rail.is-sheet-open {
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    body.mode-buyer .matches-rail .context-rail {
        border-radius: 0;
        border: none;
        box-shadow: none;
        padding-top: 8px;
    }

    body.mode-buyer .matches-rail::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        border-radius: var(--radius-pill);
        background: var(--border-color);
        margin: 8px auto 4px;
    }

    body.mode-buyer .advisor-main .chat-card {
        height: calc(100vh - var(--buyer-chrome-offset) - 56px);
    }

    body.mode-buyer .buyer-action-chips {
        bottom: 100px;
        right: 12px;
    }
}

@media (min-width: 901px) and (max-width: 1100px) {
    body.mode-buyer .decision-chat-column {
        flex: 1 1 62%;
    }

    body.mode-buyer .matches-rail {
        flex: 0 0 38%;
        min-width: 260px;
    }
}

/* ===== Phase 1: Buyer Decision Workspace ===== */

body.mode-buyer .buyer-shell {
    height: 100dvh;
    min-height: 0;
}

body.mode-buyer .buyer-header {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

body.mode-buyer .buyer-header-inner {
    padding: 10px 20px;
}

body.mode-buyer .buyer-logo-icon {
    background: linear-gradient(135deg, var(--color-primary-light) 0%, rgba(56, 189, 248, 0.15) 100%);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

body.mode-buyer .buyer-logo-subtitle {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

body.mode-buyer .buyer-journey--compact .bj-step {
    padding: 4px 8px;
}

body.mode-buyer .buyer-journey--compact .bj-dot {
    width: 18px;
    height: 18px;
    font-size: 10px;
}

body.mode-buyer .search-summary-strip {
    padding: 8px 20px 0;
}

body.mode-buyer .search-summary-card {
    border-radius: var(--module-radius);
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

body.mode-buyer .search-summary-inner {
    padding: 10px 14px;
    gap: 12px;
}

body.mode-buyer .search-summary-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
    min-width: 88px;
}

body.mode-buyer .search-summary-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-primary);
}

body.mode-buyer .search-summary-heading-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

body.mode-buyer .search-summary-criteria {
    gap: 2px 0;
}

body.mode-buyer .strip-criterion {
    font-size: 12px;
}

body.mode-buyer .strip-label {
    display: none;
}

body.mode-buyer .strip-value {
    font-weight: 600;
}

body.mode-buyer .workspace-center {
    height: auto;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

body.mode-buyer .workspace-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    align-items: stretch;
    padding: 0;
}

body.mode-buyer .decision-workspace {
    display: grid;
    grid-template-columns: var(--dashboard-col-main) var(--dashboard-col-rail);
    flex: 1;
    min-height: 0;
    max-width: var(--dashboard-max-width);
    width: 100%;
    margin: 0 auto;
    padding: var(--dashboard-gap);
    gap: var(--dashboard-gap);
    align-items: stretch;
    box-sizing: border-box;
}

body.mode-buyer .decision-chat-column,
body.mode-buyer .matches-rail {
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: static;
    max-height: none;
    flex: initial;
    min-width: 0;
}

body.mode-buyer .chat-module {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 10px;
}

body.mode-buyer .chat-module-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

body.mode-buyer .chat-module-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

body.mode-buyer .chat-module-subtitle {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

body.mode-buyer .chat-module-toolbar.buyer-action-chips {
    position: static;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    bottom: auto;
    right: auto;
    left: auto;
    z-index: auto;
}

body.mode-buyer .buyer-action-chip {
    width: auto;
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
    gap: 6px;
    font-size: 11px;
    box-shadow: none;
}

body.mode-buyer .buyer-action-chip-icon {
    width: auto;
    height: auto;
    font-size: 13px;
}

body.mode-buyer .buyer-action-chip-label {
    max-width: none;
    opacity: 1;
}

body.mode-buyer .buyer-action-chip:hover,
body.mode-buyer .buyer-action-chip:focus-visible {
    width: auto;
    max-width: none;
    height: 32px;
    min-height: 32px;
    padding: 0 10px;
}

body.mode-buyer .advisor-main .chat-card {
    margin: 0;
    flex: 1;
    min-height: 0;
    height: auto;
    max-height: none;
    border-radius: var(--module-radius);
}

body.mode-buyer .messages-container {
    padding: 14px 16px 10px;
}

body.mode-buyer .message.user .message-bubble {
    background: var(--user-bubble);
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 14px 14px 4px 14px;
    box-shadow: var(--shadow-sm);
}

body.mode-buyer .message.assistant .message-bubble {
    background: var(--assistant-bubble);
    border: 1px solid var(--border-color);
    border-radius: 14px 14px 14px 4px;
    box-shadow: var(--shadow-sm);
}

body.mode-buyer .message-avatar.chimny-avatar {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--color-primary-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

body.mode-buyer .decision-rail-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

body.mode-buyer .decision-module {
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--module-radius);
    box-shadow: var(--shadow-sm);
}

body.mode-buyer .decision-module-inner {
    padding: var(--module-padding);
}

body.mode-buyer .decision-module-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

body.mode-buyer .decision-module-title {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
}

body.mode-buyer .decision-module-desc {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
}

body.mode-buyer .decision-module-desc--muted {
    color: var(--text-muted);
}

body.mode-buyer .decision-module-link {
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
}

body.mode-buyer .decision-readiness-pct {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
}

body.mode-buyer .decision-readiness-bar {
    height: 6px;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    overflow: hidden;
    margin-bottom: 8px;
}

body.mode-buyer .decision-readiness-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-cyan) 100%);
    transition: width 0.25s ease;
}

body.mode-buyer .decision-readiness-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 6px;
    font-size: 11px;
}

body.mode-buyer .decision-readiness-stage {
    color: var(--text-muted);
}

body.mode-buyer .decision-readiness-status {
    font-weight: 600;
    color: var(--text-secondary);
}

body.mode-buyer .decision-readiness-status.is-ready {
    color: var(--color-success);
}

body.mode-buyer .decision-saved-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
}

body.mode-buyer .decision-saved-row:first-of-type {
    border-top: none;
    padding-top: 0;
}

body.mode-buyer .decision-saved-label {
    color: var(--text-muted);
}

body.mode-buyer .decision-saved-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    max-width: 62%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.mode-buyer .decision-saved-row--muted .decision-saved-value {
    font-weight: 500;
    color: var(--text-muted);
}

body.mode-buyer .decision-saved-row--focus .decision-saved-value {
    color: var(--color-primary);
}

body.mode-buyer .context-rail {
    flex: 1;
    min-height: 0;
    border-radius: var(--module-radius);
}

body.mode-buyer #property-results-section {
    display: none !important;
    visibility: hidden;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body.mode-workspace .decision-readiness,
body.mode-workspace .decision-why-matches,
body.mode-workspace .decision-saved-compare,
body.mode-workspace .chat-module-header {
    display: none !important;
}

body.mode-workspace .chat-module {
    display: contents;
}

body.mode-workspace .decision-rail-stack {
    display: contents;
}

/* Match card polish — buyer rail */
body.mode-buyer .match-card {
    grid-template-columns: 80px 1fr;
    grid-template-areas:
        "thumb main"
        "thumb actions";
    gap: 8px 10px;
    padding: 12px;
    border-radius: 12px;
}

body.mode-buyer .match-card-thumb {
    width: 80px;
    height: 80px;
    grid-area: thumb;
    align-self: start;
}

body.mode-buyer .match-card-main {
    grid-area: main;
}

body.mode-buyer .match-card-rank {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

body.mode-buyer .match-card-price {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

body.mode-buyer .match-card-badge {
    font-size: 10px;
    padding: 3px 8px;
}

body.mode-buyer .match-card-address {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
}

body.mode-buyer .match-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

body.mode-buyer .match-meta-dot {
    opacity: 0.5;
}

body.mode-buyer .match-card-fit {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.35;
}

body.mode-buyer .match-card-fit-text {
    min-width: 0;
}

body.mode-buyer .match-card-actions {
    grid-area: actions;
    grid-column: auto;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    align-self: end;
}

body.mode-buyer .match-card-action {
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
}

body.mode-buyer .match-card-action--details {
    margin-left: auto;
}

@media (max-width: 900px) {
    body.mode-buyer .decision-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
    }

    body.mode-buyer .decision-rail-stack {
        max-height: 340px;
    }

    body.mode-buyer .advisor-main .chat-card {
        min-height: 320px;
        height: auto;
    }

    body.mode-buyer .chat-module-header {
        flex-direction: column;
        align-items: stretch;
    }

    body.mode-buyer .chat-module-toolbar.buyer-action-chips {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    body.mode-buyer .decision-readiness,
    body.mode-buyer .decision-why-matches,
    body.mode-buyer .decision-saved-compare,
    body.mode-buyer .decision-summary-footer {
        display: none;
    }

    body.mode-buyer .decision-workspace {
        padding-bottom: 72px;
    }
}

/* ===== Phase 1.5: Rail priority & polish ===== */

body.mode-buyer .decision-workspace {
    grid-template-columns: minmax(0, 1fr) var(--dashboard-col-rail);
}

body.mode-buyer .decision-rail-stack {
    gap: 8px;
}

/* Listings visible: matches rail first, helpers below */
body.mode-buyer .decision-rail-stack--listings .context-rail {
    order: 1;
    flex: 1 1 auto;
    min-height: 0;
}

body.mode-buyer .decision-rail-stack--listings #buyer-readiness-card {
    order: 2;
}

body.mode-buyer .decision-rail-stack--listings #buyer-decision-footer {
    order: 3;
}

/* Setup: readiness first, then setup/matches rail */
body.mode-buyer .decision-rail-stack--setup #buyer-readiness-card {
    order: 1;
}

body.mode-buyer .decision-rail-stack--setup .context-rail {
    order: 2;
    flex: 1 1 auto;
    min-height: 0;
}

body.mode-buyer .decision-rail-stack--setup #buyer-decision-footer {
    order: 3;
}

body.mode-buyer .decision-readiness--slim {
    border-radius: 10px;
    box-shadow: none;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

body.mode-buyer .decision-rail-stack--listings .decision-readiness--slim {
    background: transparent;
    border: none;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    padding-top: 4px;
}

body.mode-buyer .readiness-slim {
    padding: 8px 10px;
}

body.mode-buyer .readiness-slim-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 6px;
    font-size: 11px;
    line-height: 1.3;
}

body.mode-buyer .readiness-slim-label {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
}

body.mode-buyer .readiness-slim-pct {
    font-weight: 700;
    color: var(--color-primary);
}

body.mode-buyer .readiness-slim-sep {
    color: var(--text-muted);
}

body.mode-buyer .readiness-slim-status {
    font-weight: 600;
    color: var(--text-primary);
}

body.mode-buyer .decision-readiness--slim.is-ready .readiness-slim-status {
    color: var(--color-success);
}

body.mode-buyer .readiness-slim-bar {
    height: 3px;
    margin-top: 6px;
    border-radius: var(--radius-pill);
    background: var(--bg-tertiary);
    overflow: hidden;
}

body.mode-buyer .readiness-slim-fill {
    height: 100%;
    border-radius: inherit;
    background: var(--color-primary);
}

body.mode-buyer .decision-readiness--slim.is-ready .readiness-slim-fill {
    background: var(--color-success);
}

body.mode-buyer .readiness-slim-hint {
    margin: 6px 0 0;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.35;
}

body.mode-buyer .context-rail-why-strip {
    flex-shrink: 0;
    padding: 0 14px 8px;
    border-bottom: 1px solid var(--border-color);
}

body.mode-buyer .context-rail-why-text {
    margin: 0;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-secondary);
}

body.mode-buyer .context-rail-why-kicker {
    font-weight: 700;
    color: var(--text-primary);
}

body.mode-buyer .decision-why-inner {
    padding: 8px 10px;
}

body.mode-buyer .decision-why-compact {
    margin: 0;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-secondary);
}

body.mode-buyer .decision-why-kicker {
    font-weight: 700;
    color: var(--text-primary);
}

body.mode-buyer .decision-summary-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

body.mode-buyer .decision-footer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 6px 10px;
    font-size: 11px;
    color: var(--text-muted);
}

body.mode-buyer .decision-footer-link {
    border: none;
    background: none;
    padding: 0;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-primary);
    cursor: pointer;
}

body.mode-buyer .decision-footer-meta {
    color: var(--text-muted);
}

body.mode-buyer .context-rail-why-strip {
    flex-shrink: 0;
}

body.mode-buyer .focused-property-box {
    flex-shrink: 0;
    margin: 0 12px 10px;
    border-radius: 12px;
    border: 1px solid color-mix(in srgb, var(--color-primary) 28%, var(--border-color));
    background: color-mix(in srgb, var(--color-primary) 6%, var(--bg-secondary));
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

body.mode-buyer .focused-property-box-inner {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 10px;
    padding: 10px 12px;
}

body.mode-buyer .focused-property-box-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-tertiary);
    align-self: start;
}

body.mode-buyer .focused-property-box-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

body.mode-buyer .focused-property-box-thumb .property-card-image-fallback {
    width: 100%;
    height: 100%;
    min-height: 56px;
}

body.mode-buyer .focused-property-box-content {
    min-width: 0;
}

body.mode-buyer .focused-property-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

body.mode-buyer .focused-property-box-kicker {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-primary);
}

body.mode-buyer .focused-property-box-clear {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

body.mode-buyer .focused-property-box-clear:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

body.mode-buyer .focused-property-box-address {
    font-size: 13px;
    font-weight: 650;
    color: var(--text-primary);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.mode-buyer .focused-property-box-meta {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

body.mode-buyer .focused-property-meta-dot {
    margin: 0 4px;
    opacity: 0.55;
}

body.mode-buyer .focused-property-box-mls {
    margin-top: 2px;
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

body.mode-buyer .focused-property-box-hint {
    margin: 6px 0 0;
    font-size: 10px;
    line-height: 1.35;
    color: var(--text-muted);
}

body.mode-buyer .decision-footer-meta--focus {
    color: var(--text-secondary);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.mode-buyer .decision-saved-compare {
    background: transparent;
    border: none;
    box-shadow: none;
}

body.mode-buyer .decision-why-matches {
    background: var(--bg-tertiary);
    border-radius: 10px;
}

/* Chat module header polish */
body.mode-buyer .chat-module-header {
    align-items: center;
    padding: 0 2px 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2px;
}

body.mode-buyer .chat-module-title {
    font-size: 14px;
}

body.mode-buyer .chat-module-subtitle {
    font-size: 11px;
    margin-top: 1px;
}

body.mode-buyer .chat-module-toolbar.buyer-action-chips {
    gap: 4px;
}

body.mode-buyer .buyer-action-chip {
    height: 30px;
    min-height: 30px;
    padding: 0 8px;
    font-size: 10px;
    border-radius: 8px;
}

/* Criteria strip — keep compact */
body.mode-buyer .search-summary-inner {
    padding: 8px 12px;
    min-height: 0;
}

body.mode-buyer .search-summary-heading-title {
    font-size: 12px;
}

/* Compact match cards */
body.mode-buyer .match-card--compact {
    display: grid;
    grid-template-columns: 64px 1fr;
    grid-template-areas: "thumb body";
    gap: 0 10px;
    padding: 10px;
    border-radius: 11px;
}

body.mode-buyer .match-card--compact .match-card-thumb {
    grid-area: thumb;
    width: 64px;
    height: 64px;
    align-self: start;
}

body.mode-buyer .match-card--compact .match-card-body {
    grid-area: body;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

body.mode-buyer .match-card--compact .match-card-price {
    font-size: 14px;
}

body.mode-buyer .match-card--compact .match-card-address {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.mode-buyer .match-card--compact .match-card-meta,
body.mode-buyer .match-card--compact .match-card-specs {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.3;
}

body.mode-buyer .match-card--compact .match-card-fit {
    font-size: 10px;
    margin-top: 2px;
    opacity: 0.9;
}

body.mode-buyer .match-card--compact .match-card-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: nowrap;
}

body.mode-buyer .match-card--compact .match-card-action {
    width: auto;
    height: 26px;
    min-width: 52px;
    padding: 0 8px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 7px;
    flex: 0 0 auto;
}

body.mode-buyer .match-card--compact .match-card-action--details {
    margin-left: auto;
    min-width: 56px;
}

body.mode-buyer .property-card-image-fallback--compact {
    height: 64px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0.7;
}

body.mode-buyer .match-cards-list {
    gap: 8px;
}

body.mode-buyer .context-rail-scroll {
    padding: 10px 12px 12px;
}

body.mode-buyer .context-rail-header {
    padding: 12px 14px 8px;
}

body.mode-workspace .decision-readiness,
body.mode-workspace .decision-summary-footer,
body.mode-workspace .context-rail-why-strip {
    display: none !important;
}

@media (max-width: 900px) {
    body.mode-buyer .decision-rail-stack {
        max-height: none;
    }

    body.mode-buyer .decision-rail-stack--listings .context-rail {
        max-height: 340px;
    }
}

/* ===== Phase 1.6: Visual polish & depth ===== */

/* Subtle layered background separates modules from the page */
body.mode-buyer .workspace-body {
    background: var(--workspace-bg);
}

body.mode-buyer .buyer-shell {
    background: var(--workspace-bg);
}

/* Premium module depth — soft shadow + hairline border */
body.mode-buyer .advisor-main .chat-card,
body.mode-buyer .context-rail,
body.mode-buyer .decision-why-matches {
    border-color: var(--module-border);
    box-shadow: var(--module-shadow);
}

body.mode-buyer .search-summary-card {
    border-color: var(--module-border);
    box-shadow: var(--module-shadow);
}

/* Chat module: title row integrated into the card, no detached gap */
body.mode-buyer .chat-module {
    gap: 0;
}

body.mode-buyer .chat-module-header {
    padding: 12px 16px;
    margin-bottom: 0;
    background: var(--bg-card);
    border: 1px solid var(--module-border);
    border-bottom: 1px solid var(--module-border);
    border-radius: var(--module-radius) var(--module-radius) 0 0;
    box-shadow: var(--module-shadow);
}

body.mode-buyer .advisor-main .chat-card {
    border-radius: 0 0 var(--module-radius) var(--module-radius);
    border-top: none;
    box-shadow: var(--module-shadow);
}

/* Match cards — real product card feel */
body.mode-buyer .match-card--compact {
    border-color: var(--module-border);
    box-shadow: var(--module-shadow);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

body.mode-buyer .match-card--compact:hover {
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: var(--module-shadow-hover);
    transform: translateY(-1px);
}

body.mode-buyer .match-card--compact.is-selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary), var(--module-shadow);
}

/* Stronger price hierarchy, readable secondary text */
body.mode-buyer .match-card--compact .match-card-price {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

body.mode-buyer .match-card--compact .match-card-address {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-primary);
}

body.mode-buyer .match-card--compact .match-card-fit {
    color: var(--text-secondary);
    opacity: 1;
}

/* Premium, lighter placeholder for missing photos */
body.mode-buyer .property-card-image-fallback--compact {
    height: 64px;
    background:
        radial-gradient(circle at 30% 30%, rgba(37, 99, 235, 0.06), transparent 70%),
        var(--bg-tertiary);
    color: var(--text-muted);
    opacity: 1;
    border-radius: 9px;
}

body.mode-buyer .property-card-image-fallback--compact .property-card-image-icon {
    width: 20px;
    height: 20px;
    opacity: 0.5;
}

/* "Why these matches?" — supporting insight, not a content block */
body.mode-buyer .context-rail-why-strip {
    padding: 8px 14px 10px;
    border-bottom: 1px solid var(--module-border);
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.035), transparent);
}

body.mode-buyer .context-rail-why-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-muted);
}

body.mode-buyer .context-rail-why-kicker {
    color: var(--color-primary);
    font-weight: 700;
}

/* Criteria strip — consistent icon badges & dividers */
body.mode-buyer .search-summary-card {
    border-radius: 12px;
}

body.mode-buyer .strip-icon {
    width: 24px;
    height: 24px;
    border-radius: 7px;
}

body.mode-buyer .strip-divider {
    margin: 0 10px;
    height: 14px;
}

/* Readiness slim — a touch more premium when standalone (setup) */
body.mode-buyer .decision-rail-stack--setup .decision-readiness--slim {
    border-color: var(--module-border);
    box-shadow: var(--module-shadow);
}

/* =====================================================================
   Phase 1.7: Production UX stabilization
   - Hide debug/destructive controls for normal buyers
   - Chat bottom spacing so the last message clears the composer
   - Lighter, more readable "Why these matches?" strip
   - Final match-card placeholder polish
   - Criteria strip / header alignment + mobile de-clutter
   ===================================================================== */

/* Destructive reset chips live in the More menu for normal buyers; only
   surface them in the chat header when debug/admin is active. */
body.mode-buyer .chat-action-advanced {
    display: none;
}
body.is-debug .chat-action-advanced,
body.is-admin .chat-action-advanced {
    display: inline-flex;
}

/* Logging indicator is debug-only; CSS backstop in case JS runs late. */
body:not(.is-debug):not(.is-admin) .replay-logging-indicator {
    display: none !important;
}

/* Chat bottom spacing: keep the last message, timestamp, and any trailing
   chips fully visible above the composer. */
body.mode-buyer .messages-container {
    padding: 14px 16px 18px;
    scroll-padding-bottom: 18px;
}

body.mode-buyer .messages-container > .message:last-child {
    margin-bottom: 4px;
}

/* Composer is a flex sibling pinned at the bottom of the card; the messages
   list scrolls above it. Bottom padding on the list (above) guarantees the
   last message clears the composer. */
body.mode-buyer .chat-composer {
    z-index: 2;
    padding: 10px 20px 12px;
    border-top: 1px solid var(--module-border);
    background: var(--bg-card);
    border-radius: 0 0 var(--module-radius) var(--module-radius);
}

/* "Why these matches?" — slightly more readable while staying secondary. */
body.mode-buyer .context-rail-why-strip {
    padding: 9px 14px 11px;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.04), transparent);
}

body.mode-buyer .context-rail-why-text {
    font-size: 11.5px;
    line-height: 1.5;
    color: var(--text-secondary);
    -webkit-line-clamp: 2;
}

body.mode-buyer .context-rail-why-kicker {
    color: var(--color-primary);
    font-weight: 700;
    margin-right: 4px;
}

/* Match-card placeholder: softer, smaller icon, less prototype-like. */
body.mode-buyer .property-card-image-fallback--compact {
    height: 60px;
    background:
        radial-gradient(circle at 50% 38%, rgba(148, 163, 184, 0.14), transparent 72%),
        var(--bg-tertiary);
    color: var(--text-muted);
    border-radius: 9px;
}

body.mode-buyer .property-card-image-fallback--compact .property-card-image-icon {
    width: 16px;
    height: 16px;
    opacity: 0.4;
}

/* Match-card actions: keep the established single-row layout, just ensure a
   consistent gap so Save / Compare / Details never visually merge. */
body.mode-buyer .match-card--compact .match-card-actions {
    gap: 8px;
}

/* Criteria strip aligns to the same inner width as the content below. */
body.mode-buyer .search-summary-card {
    width: 100%;
}

body.mode-buyer .search-summary-inner {
    flex-wrap: wrap;
    row-gap: 6px;
    min-height: 32px;
}

/* Mobile/tablet: keep the header uncluttered — no reset/logging noise. */
@media (max-width: 768px) {
    body.mode-buyer .chat-action-advanced {
        display: none !important;
    }
    body.mode-buyer .replay-logging-indicator {
        display: none !important;
    }
    body.mode-buyer .messages-container {
        padding-bottom: 16px;
    }
}

/* =====================================================================
   Phase 1.8: Chat + Matches scroll safety
   - Chat header stays in normal flow above messages (no overlay clipping)
   - Right rail (Top Matches) scrolls internally, bounded to column height
   - Debug/reset visibility backstops
   ===================================================================== */

/* The chat-module header is a normal-flow sibling above the card. Render it
   above any card shadow and give messages enough top breathing room so the
   first bubble + assistant avatar are never clipped under it. */
body.mode-buyer .chat-module-header {
    position: relative;
    z-index: 2;
}

body.mode-buyer .messages-container {
    padding-top: 16px;
    scroll-padding-top: 16px;
}

body.mode-buyer .messages-container > .message:first-child {
    margin-top: 2px;
}

/* Right rail: bound the rail to the same available height as the chat column
   (the row stretches both), so the Top Matches card list scrolls internally
   instead of pushing the whole page. */
body.mode-buyer .matches-rail {
    min-height: 0;
    max-height: calc(100vh - var(--buyer-chrome-offset) - 24px);
    overflow: hidden;
}

body.mode-buyer .decision-rail-stack {
    min-height: 0;
    overflow: hidden;
}

/* Top Matches card: header stays put, only the card list scrolls beneath it. */
body.mode-buyer .decision-rail-stack--listings .context-rail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

body.mode-buyer .context-rail-header,
body.mode-buyer .context-rail-why-strip {
    flex-shrink: 0;
}

body.mode-buyer .context-rail-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

/* Subtle, product-consistent scrollbar for the rail list. */
body.mode-buyer .context-rail-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}
body.mode-buyer .context-rail-scroll::-webkit-scrollbar {
    width: 8px;
}
body.mode-buyer .context-rail-scroll::-webkit-scrollbar-track {
    background: transparent;
}
body.mode-buyer .context-rail-scroll::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
body.mode-buyer .context-rail-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
    background-clip: padding-box;
}

/* Helper modules below Top Matches must not steal the list's scroll height;
   keep them intrinsic and let the card list flex. */
body.mode-buyer .decision-rail-stack--listings #buyer-readiness-card,
body.mode-buyer .decision-rail-stack--listings #buyer-decision-footer {
    flex-shrink: 0;
}

/* Mobile sheet: the rail is a fixed bottom sheet; keep its list scrollable. */
@media (max-width: 768px) {
    body.mode-buyer .matches-rail {
        max-height: min(72vh, 560px);
        overflow: hidden;
    }
    body.mode-buyer .decision-rail-stack {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    body.mode-buyer .decision-rail-stack--listings .context-rail {
        max-height: none;
        overflow: visible;
    }
}

/* ============================================================
   Phase 1.9: Result state consistency & loading semantics
   ============================================================ */

/* Pending assistant bubble: inline typing dots instead of a blank card. */
.message.assistant.is-pending .message-bubble {
    display: inline-flex;
    align-items: center;
}
.message-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 2px;
}
.message-pending .typing-dot {
    width: 7px;
    height: 7px;
}

/* "Matches found" state — count was returned but cards are withheld. */
.context-rail-panel--matches-found {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.context-rail-matches-found {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.context-rail-matches-found-count {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.context-rail-matches-found-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* "Many matches found" helper above the listing cards. */
.context-rail-many-helper {
    margin: 0 0 10px;
    padding: 8px 11px;
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-secondary);
    background: var(--bg-subtle, rgba(120, 120, 140, 0.06));
    border: 1px solid var(--module-border);
    border-radius: 9px;
}
