:root {
    --ink: #172424;
    --muted: #647473;
    --line: #dce4e1;
    --line-strong: #c9d5d1;
    --surface: #ffffff;
    --surface-soft: #f4f7f5;
    --surface-warm: #f5f1e8;
    --brand: #123e3f;
    --brand-hover: #0b3132;
    --accent: #c88e4f;
    --accent-soft: #f8eadb;
    --danger: #a33d35;
    --danger-soft: #fff1ef;
    --success: #27745f;
    --shadow: 0 22px 58px rgba(19, 44, 43, 0.09);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 10px;
    font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.privacy-page {
    min-height: 100vh;
    padding: 32px 18px;
    background: var(--surface-soft);
}

.manager-session-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.application-list,
.application-detail,
.application-messages {
    display: grid;
    gap: 0.75rem;
}

.application-summary {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem 0.75rem;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: var(--surface);
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.application-summary:hover,
.application-summary.is-selected {
    border-color: var(--accent);
}

.application-status {
    color: var(--accent);
}

.application-section {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
}

.application-section h3 {
    margin-top: 0;
}

.application-contact {
    overflow-wrap: anywhere;
    font-weight: 700;
}

.application-lot {
    display: grid;
    gap: 0.2rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
}

.application-lot:last-child {
    border-bottom: 0;
}

.application-message {
    max-width: 88%;
    padding: 0.75rem 0.9rem;
    border-radius: 0.8rem;
    background: var(--surface);
    border: 1px solid var(--line);
}

.application-message.is-user {
    justify-self: end;
    background: var(--accent-soft);
}

.application-message p {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.application-message time {
    font-size: 0.78rem;
    color: var(--muted);
}

.captured-email {
    padding: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
}

.captured-email summary {
    cursor: pointer;
    overflow-wrap: anywhere;
}

.captured-email pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.privacy-document {
    width: min(760px, 100%);
    margin: 0 auto;
    padding: 32px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(16, 44, 43, 0.12);
}

.privacy-document h1,
.privacy-document h2 {
    margin-top: 24px;
}

.privacy-document p {
    margin-top: 12px;
    line-height: 1.65;
}

.privacy-document hr {
    margin: 28px 0;
    border: 0;
    border-top: 1px solid var(--line);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: #eef3f0;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 8% 0%, rgba(200, 142, 79, 0.13), transparent 28rem),
        linear-gradient(155deg, #f7f8f4 0%, #edf3f0 70%);
}

button,
textarea,
input,
select {
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(200, 142, 79, 0.35);
    outline-offset: 2px;
}

button:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: 0.56;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

[hidden] {
    display: none !important;
}

.app-shell {
    width: min(1500px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 20px clamp(16px, 3vw, 44px) 18px;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 18px;
}

.app-header {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.brand {
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 18px;
    letter-spacing: -0.02em;
}

.brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    padding: 10px;
    background: var(--brand);
    box-shadow: 0 8px 20px rgba(18, 62, 63, 0.18);
}

.brand-mark span {
    width: 5px;
    border-radius: 2px 2px 0 0;
    background: #f5e9d7;
}

.brand-mark span:nth-child(1) {
    height: 10px;
}

.brand-mark span:nth-child(2) {
    height: 20px;
}

.brand-mark span:nth-child(3) {
    height: 15px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.language-control select {
    height: 42px;
    padding: 0 28px 0 12px;
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.7);
}

.button {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 11px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-weight: 650;
    font-size: 13px;
    transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.button:not(:disabled):active,
.send-button:not(:disabled):active {
    transform: translateY(1px);
}

.button-primary {
    color: #fff;
    background: var(--brand);
}

.button-primary:not(:disabled):hover {
    background: var(--brand-hover);
}

.button-secondary {
    color: var(--brand);
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.75);
}

.button-secondary:not(:disabled):hover {
    background: #fff;
    border-color: #aebfba;
}

.workspace {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(340px, 0.85fr);
    gap: 18px;
}

.mobile-section-nav {
    display: none;
}

.chat-panel,
.results-panel {
    min-height: 0;
    border: 1px solid rgba(201, 213, 209, 0.82);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.chat-panel {
    display: grid;
    grid-template-rows: auto auto auto minmax(280px, 1fr) auto;
    overflow: hidden;
}

.panel-heading,
.results-heading,
.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.panel-heading {
    padding: 24px 26px 20px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    margin: 0 0 5px;
    color: var(--accent);
    font-size: 10px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(22px, 2.4vw, 32px);
    line-height: 1.12;
    font-weight: 500;
    letter-spacing: -0.025em;
}

h2,
h3 {
    margin: 0;
    letter-spacing: -0.02em;
}

.connection-status {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    color: var(--muted);
    background: var(--surface-soft);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 650;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aab6b2;
}

.connection-status.is-online .status-dot {
    background: #35a77e;
    box-shadow: 0 0 0 4px rgba(53, 167, 126, 0.12);
}

.connection-status.is-busy .status-dot {
    background: var(--accent);
    animation: pulse 1.25s ease-in-out infinite;
}

.connection-status.is-error .status-dot {
    background: var(--danger);
}

@keyframes pulse {
    50% {
        opacity: 0.4;
    }
}

.error-banner {
    margin: 14px 18px 0;
    padding: 12px 14px;
    border: 1px solid #f2c9c5;
    border-radius: 12px;
    color: #7c302a;
    background: var(--danger-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.error-banner strong {
    font-size: 13px;
}

.error-banner p {
    margin: 3px 0 0;
    font-size: 12px;
}

.text-button {
    padding: 4px;
    color: inherit;
    border: 0;
    background: transparent;
    font-size: 12px;
    font-weight: 750;
    text-decoration: underline;
}

.manual-setup {
    margin: 22px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
}

.manual-setup h2 {
    font-size: 20px;
}

.manual-setup > p:not(.eyebrow) {
    margin: 8px 0 18px;
    color: var(--muted);
    font-size: 13px;
}

.manual-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
    gap: 10px;
}

.manual-form label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.manual-form input {
    width: 100%;
    height: 42px;
    padding: 0 11px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
}

.messages {
    min-height: 0;
    padding: 24px clamp(18px, 3vw, 34px);
    overflow: auto;
    overscroll-behavior: contain;
    scroll-behavior: smooth;
}

.welcome-state {
    min-height: 100%;
    max-width: 610px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.welcome-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 15px;
    display: grid;
    place-items: center;
    color: var(--brand);
    background: #e5efeb;
    border-radius: 17px;
    font-size: 28px;
}

.welcome-state h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: 500;
    font-size: clamp(22px, 3vw, 29px);
}

.welcome-state > p {
    max-width: 560px;
    margin: 10px 0 20px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.suggestion-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.suggestion {
    padding: 9px 12px;
    color: #435653;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-size: 12px;
    transition: border-color 150ms ease, background 150ms ease;
}

.suggestion:hover {
    border-color: #b4c6c0;
    background: var(--surface-soft);
}

.message {
    max-width: 82%;
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.message-user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.avatar {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    color: #fff;
    background: var(--brand);
    border-radius: 10px;
    font-size: 9px;
    font-weight: 800;
}

.message-user .avatar {
    color: #6b4c29;
    background: var(--accent-soft);
}

.message-body {
    min-width: 0;
}

.message-content {
    margin: 0;
    padding: 11px 14px;
    border-radius: 4px 16px 16px 16px;
    white-space: pre-wrap;
    color: #30403e;
    background: var(--surface-soft);
    line-height: 1.55;
    font-size: 14px;
}

.message-user .message-content {
    color: #fff;
    background: var(--brand);
    border-radius: 16px 4px 16px 16px;
}

.message-content.has-comparison-table {
    white-space: normal;
}

.message-content.has-comparison-table .message-text {
    white-space: pre-wrap;
}

.message-table-wrapper {
    margin: 9px 0;
    overflow-x: auto;
}

.message-table {
    width: 100%;
    min-width: 430px;
    border-collapse: collapse;
    font-size: 12px;
    line-height: 1.35;
}

.message-table th,
.message-table td {
    padding: 7px 8px;
    border: 1px solid #ccd9d5;
    vertical-align: top;
    text-align: left;
}

.message-table th {
    color: #244743;
    background: #e7f0ed;
    font-weight: 700;
}

.message-table tbody th {
    background: #f3f7f5;
}

.web-evidence,
.web-evidence-unavailable {
    margin: 7px 0 0;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
}

.web-evidence-title {
    display: block;
    color: #50635f;
    font-size: 10px;
    letter-spacing: 0.02em;
}

.web-evidence-notice {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.web-evidence-list {
    margin: 7px 0 0;
    padding: 0;
    display: grid;
    gap: 5px;
    list-style: none;
}

.web-evidence-list a {
    min-width: 0;
    padding: 6px 7px;
    display: grid;
    gap: 2px;
    color: var(--brand);
    border-radius: 7px;
    background: var(--surface-soft);
    text-decoration: none;
}

.web-evidence-list a:hover,
.web-evidence-list a:focus-visible {
    color: #173f3d;
    background: #e7f0ed;
    text-decoration: underline;
}

.web-evidence-link-title,
.web-evidence-host,
.web-evidence-retrieved-at {
    overflow-wrap: anywhere;
}

.web-evidence-link-title {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}

.web-evidence-host,
.web-evidence-retrieved-at {
    color: var(--muted);
    font-size: 9px;
}

.web-evidence-unavailable {
    color: #76502a;
    border-color: #ead0ad;
    background: #fff8ef;
    font-size: 10px;
    line-height: 1.45;
}

.message-meta {
    display: block;
    margin: 5px 4px 0;
    color: #8b9996;
    font-size: 10px;
}

.message-user .message-meta {
    text-align: right;
}

.message.is-pending {
    opacity: 0.72;
}

.typing-dots {
    min-width: 55px;
    height: 39px;
    padding: 0 14px;
    border-radius: 4px 16px 16px 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-soft);
}

.typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #82918e;
    animation: typing 1.1s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 140ms;
}

.typing-dots span:nth-child(3) {
    animation-delay: 280ms;
}

@keyframes typing {
    50% {
        transform: translateY(-3px);
        opacity: 0.5;
    }
}

.composer {
    padding: 13px 16px 15px;
    border-top: 1px solid var(--line);
    background: rgba(251, 252, 251, 0.94);
}

.composer textarea {
    width: 100%;
    max-height: 150px;
    min-height: 48px;
    padding: 12px 13px;
    resize: none;
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: #fff;
    line-height: 1.45;
}

.composer textarea::placeholder {
    color: #97a39f;
}

.composer-footer {
    min-height: 34px;
    padding: 8px 1px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.composer-hint,
.character-counter {
    color: #879592;
    font-size: 10px;
}

.character-counter {
    margin-left: auto;
}

.character-counter.is-near-limit {
    color: var(--danger);
}

.send-button {
    min-height: 34px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #fff;
    border: 0;
    border-radius: 10px;
    background: var(--brand);
    font-size: 12px;
    font-weight: 750;
}

.results-panel {
    padding: 22px;
    overflow: auto;
}

.results-heading {
    padding-bottom: 17px;
    border-bottom: 1px solid var(--line);
}

.results-heading h2 {
    font-size: 19px;
}

.count-badge {
    min-width: 29px;
    height: 29px;
    padding: 0 9px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    color: var(--brand);
    background: #e5efeb;
    font-size: 12px;
    font-weight: 800;
}

.decision-panel {
    margin-top: 15px;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface-soft);
}

.decision-panel.is-warning {
    background: #fff6e9;
}

.decision-badge {
    display: inline-flex;
    padding: 4px 7px;
    color: var(--brand);
    border-radius: 6px;
    background: #deebe6;
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.decision-panel p {
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
}

.recommendations {
    margin-top: 16px;
    display: grid;
    gap: 12px;
}

.results-empty {
    min-height: 230px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #83918e;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-md);
    text-align: center;
}

.results-empty span {
    font-size: 29px;
}

.results-empty p {
    max-width: 250px;
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
}

.geography-panel {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.geography-panel h3 {
    margin: 3px 0 11px;
    font-size: 16px;
}

.geography-results {
    display: grid;
    gap: 9px;
}

.geography-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
}

.geography-card summary {
    padding: 12px 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
    list-style-position: inside;
}

.geography-card summary:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.geography-summary-title {
    font-size: 12px;
    font-weight: 800;
}

.geography-status {
    max-width: 45%;
    color: var(--muted);
    font-size: 10px;
    text-align: right;
}

.geography-card-body {
    padding: 0 13px 13px;
    display: grid;
    gap: 10px;
}

.local-map-plot {
    margin: 0;
    overflow: hidden;
    border: 1px solid #dce9e5;
    border-radius: 12px;
    background: linear-gradient(145deg, #f6fbf9, #edf6f2);
}

.local-map-plot svg {
    width: 100%;
    max-height: 220px;
    display: block;
}

.local-map-plot figcaption {
    padding: 7px 10px;
    color: var(--muted);
    border-top: 1px solid #dce9e5;
    font-size: 10px;
}

.local-map-grid {
    fill: none;
    stroke: #d7e7e1;
    stroke-width: 0.45;
}

.local-map-marker circle {
    fill: #fff;
    stroke: var(--brand);
    stroke-width: 1.3;
}

.local-map-marker.marker-subject circle {
    fill: var(--brand);
}

.local-map-marker text {
    fill: var(--brand-dark);
    font-size: 4px;
    font-weight: 900;
    text-anchor: middle;
    pointer-events: none;
}

.local-map-marker.marker-subject text {
    fill: #fff;
}

.geography-place-list {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 7px;
    list-style: none;
}

.geography-place-list li {
    padding: 8px 9px;
    display: grid;
    gap: 2px;
    border-radius: 9px;
    background: var(--surface-soft);
    font-size: 11px;
}

.geography-place-list span,
.geography-notice,
.geography-attribution {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.geography-notice,
.geography-attribution {
    margin: 0;
}

.geography-place-meta {
    color: var(--brand-dark) !important;
    font-weight: 700;
}

.geography-external {
    padding: 9px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px 11px;
    border-radius: 9px;
    background: #f4f7f6;
}

.geography-external .geography-notice {
    flex-basis: 100%;
}

.geography-external-link {
    color: var(--brand);
    font-size: 10px;
    font-weight: 800;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.recommendation-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    transition: box-shadow 160ms ease, border-color 160ms ease;
}

.recommendation-card:hover {
    border-color: #bdcbc7;
    box-shadow: 0 12px 30px rgba(24, 56, 53, 0.08);
}

.property-image {
    width: 100%;
    aspect-ratio: 16 / 8.5;
    display: block;
    object-fit: cover;
    background: #e9efec;
}

.property-placeholder {
    aspect-ratio: 16 / 6.8;
    padding: 16px;
    display: flex;
    align-items: flex-end;
    color: rgba(255, 255, 255, 0.82);
    background:
        linear-gradient(135deg, rgba(18, 62, 63, 0.88), rgba(46, 92, 88, 0.64)),
        repeating-linear-gradient(90deg, transparent 0 30px, rgba(255, 255, 255, 0.08) 30px 32px);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
}

.recommendation-content {
    padding: 15px;
}

.recommendation-alternative-badge {
    display: inline-flex;
    max-width: 100%;
    margin-bottom: 10px;
    padding: 5px 8px;
    color: #76502a;
    border: 1px solid #ead0ad;
    border-radius: 999px;
    background: var(--accent-soft);
    font-size: 10px;
    font-weight: 760;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.recommendation-topline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.recommendation-card h3 {
    font-size: 15px;
    line-height: 1.3;
}

.recommendation-price {
    margin-top: 4px;
    color: var(--brand);
    font-size: 17px;
    font-weight: 780;
    white-space: nowrap;
}

.score {
    flex: 0 0 auto;
    padding: 5px 7px;
    color: #37685d;
    background: #e8f1ed;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 750;
}

.feature-chips {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.feature-chip {
    padding: 5px 7px;
    color: #516461;
    border-radius: 7px;
    background: var(--surface-soft);
    font-size: 10px;
}

.recommendation-explanation {
    margin: 11px 0 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

.recommendation-assessment {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.recommendation-assessment p {
    margin: 0;
    font-size: 11px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.recommendation-assessment p + p {
    margin-top: 6px;
}

.recommendation-matches {
    color: var(--success);
}

.recommendation-mismatch {
    padding: 7px 8px;
    color: #76502a;
    border-left: 3px solid var(--accent);
    border-radius: 0 7px 7px 0;
    background: #fff8ef;
}

.single-result-note,
.zero-result-note {
    padding: 12px;
    border-radius: 12px;
    color: #6c512f;
    background: #fff6e9;
    font-size: 11px;
    line-height: 1.45;
}

.zero-result-note {
    color: #6b4945;
    background: var(--danger-soft);
}

.app-footer {
    min-height: 22px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #73827f;
    font-size: 10px;
}

.buyer-card-dialog {
    width: min(900px, calc(100% - 28px));
    max-height: min(850px, calc(100vh - 28px));
    padding: 0;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
    box-shadow: 0 35px 100px rgba(16, 44, 43, 0.28);
}

.buyer-card-dialog::backdrop {
    background: rgba(9, 29, 29, 0.46);
    backdrop-filter: blur(3px);
}

.confirmation-dialog {
    width: min(440px, calc(100% - 28px));
    padding: 0;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 30px 90px rgba(16, 44, 43, 0.28);
}

.confirmation-dialog::backdrop {
    background: rgba(9, 29, 29, 0.46);
    backdrop-filter: blur(3px);
}

.confirmation-content {
    padding: 24px;
}

.confirmation-content h2 {
    font-size: 21px;
}

.confirmation-content p {
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.confirmation-actions {
    margin-top: 22px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.ai-consent-dialog {
    width: min(620px, calc(100% - 28px));
}

.ai-consent-notice {
    white-space: pre-line;
}

.ai-consent-processor {
    padding: 12px;
    border-radius: 10px;
    background: var(--surface-soft);
}

.ai-consent-actions {
    flex-wrap: wrap;
}

.consent-settings-button {
    margin-left: auto;
    white-space: nowrap;
}

.dialog-header {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 20px 23px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
}

.dialog-header h2 {
    font-size: 22px;
}

.icon-button {
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    font-size: 22px;
}

.buyer-card-content {
    padding: 22px 23px 27px;
    overflow: auto;
}

.card-loading {
    min-height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.manager-summary {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.manager-narrative {
    padding: 16px;
    border: 1px solid #cfe1dc;
    border-radius: 13px;
    background: #f1f8f6;
}

.manager-narrative p {
    margin: 0;
    color: #243d39;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.manager-narrative-meta {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 10px;
}

.manager-narrative-meta span {
    font-weight: 700;
}

.summary-tile {
    min-height: 85px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface-soft);
}

.summary-tile span {
    display: block;
    color: var(--muted);
    font-size: 10px;
}

.summary-tile strong {
    display: block;
    margin-top: 7px;
    font-size: 15px;
}

.attention-box {
    margin-top: 13px;
    padding: 13px;
    color: #6f4f29;
    border-radius: 12px;
    background: #fff5e5;
}

.attention-box strong {
    font-size: 12px;
}

.attention-box ul {
    margin: 7px 0 0;
    padding-left: 18px;
    font-size: 11px;
    line-height: 1.55;
}

.card-section {
    margin-top: 22px;
}

.card-section-heading {
    margin-bottom: 10px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.card-section h3 {
    font-size: 15px;
}

.card-section-heading span {
    color: var(--muted);
    font-size: 10px;
}

.criteria-table {
    border: 1px solid var(--line);
    border-radius: 13px;
    overflow: hidden;
}

.criterion-row {
    padding: 11px 13px;
    display: grid;
    grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 1.4fr) auto;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
}

.criterion-row:last-child {
    border-bottom: 0;
}

.criterion-name {
    font-weight: 700;
}

.criterion-value {
    color: #3f5551;
}

.criterion-mode {
    padding: 4px 6px;
    border-radius: 6px;
    color: #576966;
    background: var(--surface-soft);
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
}

.missing-list {
    display: grid;
    gap: 7px;
}

.missing-item {
    padding: 10px 12px;
    border: 1px solid #f0d7b8;
    border-radius: 10px;
    background: #fffaf2;
    font-size: 11px;
}

.missing-item strong,
.missing-item span {
    display: block;
}

.missing-item span {
    margin-top: 3px;
    color: var(--muted);
}

.buyer-recommendations {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.manager-transcript {
    display: grid;
    gap: 8px;
}

.transcript-message {
    max-width: 88%;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.transcript-user {
    margin-left: auto;
    border-color: #c9ddd8;
    background: #eef7f5;
}

.transcript-system {
    max-width: 100%;
    border-style: dashed;
    background: var(--surface-soft);
}

.transcript-message-heading {
    margin-bottom: 5px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.transcript-message-heading strong {
    font-size: 10px;
}

.transcript-message-heading time {
    color: var(--muted);
    font-size: 9px;
}

.transcript-message p {
    margin: 0;
    color: #354a46;
    font-size: 11px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.empty-card-section {
    padding: 16px;
    color: var(--muted);
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
    text-align: center;
    font-size: 11px;
}

.dialog-error {
    padding: 16px;
    color: var(--danger);
    border-radius: 12px;
    background: var(--danger-soft);
    font-size: 12px;
}

.handoff-panel {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid #c9ddd8;
    border-radius: 16px;
    background: linear-gradient(145deg, #f5fbf9, #ffffff);
}

.handoff-panel h3 {
    margin: 4px 0 8px;
    font-size: 17px;
}

.handoff-panel > p:not(.eyebrow) {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.handoff-form,
.handoff-form label {
    display: grid;
    gap: 7px;
}

.handoff-form {
    gap: 12px;
}

.handoff-intent-field {
    padding: 12px;
    border: 1px solid #b9d2cb;
    border-radius: 12px;
    background: #edf7f4;
}

.handoff-selection {
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.handoff-selection legend {
    max-width: 100%;
    padding: 0 5px;
    color: #405450;
    font-size: 11px;
    font-weight: 750;
    line-height: 1.35;
}

.handoff-selection-description {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.handoff-lot-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 7px;
}

.handoff-form .handoff-lot-choice {
    min-width: 0;
    padding: 9px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    cursor: pointer;
}

.handoff-form .handoff-lot-choice:has(input:checked) {
    border-color: #80aa9f;
    background: #eef7f4;
}

.handoff-form .handoff-lot-choice input {
    width: 16px;
    min-height: 16px;
    margin: 2px 0 0;
    padding: 0;
    accent-color: var(--brand);
}

.handoff-lot-description {
    min-width: 0;
}

.handoff-lot-description strong,
.handoff-lot-description small {
    display: block;
    overflow-wrap: anywhere;
}

.handoff-lot-description strong {
    color: #304541;
    font-size: 10px;
    line-height: 1.35;
}

.handoff-lot-description small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.handoff-selection-summary {
    margin: 10px 0 0;
    padding: 8px 9px;
    color: #70502d;
    border-radius: 8px;
    background: #fff6e9;
    font-size: 10px;
    line-height: 1.45;
}

.handoff-selection-summary.has-selection {
    color: #315f55;
    background: #e8f3ef;
}

.handoff-form label > span {
    color: #405450;
    font-size: 11px;
    font-weight: 700;
}

.handoff-form input,
.handoff-form select {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

.handoff-contact-row {
    display: grid;
    grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.3fr);
    gap: 10px;
}

.handoff-preview {
    padding: 12px;
    border: 1px solid #9fc2b8;
    border-radius: 12px;
    background: #edf7f4;
}

.handoff-preview h4 {
    margin: 0 0 8px;
    color: #304541;
    font-size: 12px;
}

.handoff-preview-recipients {
    display: grid;
    gap: 8px;
}

.handoff-preview-recipient {
    padding: 9px;
    border-radius: 8px;
    background: #fff;
    color: #405450;
    font-size: 10px;
    line-height: 1.45;
}

.handoff-preview-recipient strong,
.handoff-preview-recipient span {
    display: block;
    overflow-wrap: anywhere;
}

.handoff-preview-notice {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.consent-check {
    grid-template-columns: auto 1fr;
    align-items: start;
    padding: 11px;
    border-radius: 10px;
    background: var(--surface-soft);
}

.consent-check input {
    width: 17px;
    min-height: 17px;
    margin-top: 1px;
}

.consent-check span {
    font-weight: 500 !important;
    line-height: 1.45;
}

.handoff-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.handoff-status {
    min-height: 18px;
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

.handoff-status.is-success {
    color: var(--success);
}

.handoff-status.is-error {
    color: var(--danger);
}

.handoff-status.is-warning {
    padding: 9px 10px;
    color: #76502a;
    border-radius: 8px;
    background: #fff6e9;
    line-height: 1.45;
}

.offer-set-card {
    grid-column: 1 / -1;
    padding: 14px;
    border: 1px solid #d5c596;
    border-radius: 14px;
    background: #fffaf0;
}

.offer-set-card h3 {
    margin: 0 0 7px;
    font-size: 15px;
}

.offer-set-components {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.offer-set-warning {
    margin: 9px 0 0;
    color: #765e22;
    font-size: 11px;
    line-height: 1.45;
}

@media (max-width: 1000px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .chat-panel {
        min-height: min(720px, calc(100vh - 135px));
    }

    .results-panel {
        max-height: none;
    }

    .recommendations {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .results-empty,
    .decision-panel,
    .single-result-note,
    .zero-result-note {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    html {
        scroll-behavior: smooth;
        scroll-padding-top: 62px;
    }

    .app-shell {
        padding: 12px;
        gap: 12px;
    }

    .error-banner:not([hidden]) {
        position: fixed;
        top: 66px;
        right: 12px;
        left: 12px;
        z-index: 50;
        margin: 0;
        box-shadow: 0 12px 34px rgba(84, 32, 27, 0.22);
    }

    .workspace {
        align-items: start;
    }

    .mobile-section-nav {
        position: sticky;
        top: 8px;
        z-index: 20;
        padding: 4px;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
        border: 1px solid var(--line-strong);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 10px 28px rgba(19, 44, 43, 0.12);
        backdrop-filter: blur(14px);
    }

    .mobile-section-nav a {
        min-height: 40px;
        padding: 0 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        color: var(--brand);
        border-radius: 10px;
        text-decoration: none;
        font-size: 13px;
        font-weight: 750;
    }

    .mobile-section-nav a:last-child {
        color: #fff;
        background: var(--brand);
    }

    .mobile-result-count {
        min-width: 21px;
        height: 21px;
        padding: 0 6px;
        display: grid;
        place-items: center;
        color: var(--brand);
        border-radius: 999px;
        background: #fff;
        font-size: 10px;
    }

    .app-header {
        align-items: flex-start;
    }

    .brand small,
    .button-secondary span:not(:first-child) {
        display: none;
    }

    .header-actions {
        gap: 6px;
    }

    .language-control select {
        height: 38px;
    }

    .button {
        min-height: 38px;
        padding: 0 11px;
        font-size: 11px;
    }

    .chat-panel {
        min-height: 0;
        display: block;
        overflow: visible;
        border-radius: 18px;
        scroll-margin-top: 62px;
    }

    .panel-heading {
        padding: 18px;
        align-items: flex-start;
    }

    .connection-status {
        padding: 6px 7px;
    }

    .connection-status span:last-child {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .messages {
        min-height: 48svh;
        padding: 20px 15px;
        overflow: visible;
        overscroll-behavior: auto;
    }

    .messages > :last-child {
        scroll-margin-bottom: 118px;
    }

    .composer {
        position: sticky;
        bottom: 0;
        z-index: 10;
        border-radius: 0 0 18px 18px;
        box-shadow: 0 -12px 26px rgba(19, 44, 43, 0.08);
    }

    .message {
        max-width: 93%;
    }

    .composer-hint {
        display: none;
    }

    .manual-form {
        grid-template-columns: 1fr;
    }

    .results-panel {
        padding: 17px;
        overflow: visible;
        border-radius: 18px;
        scroll-margin-top: 62px;
    }

    .recommendations,
    .buyer-recommendations {
        grid-template-columns: 1fr;
    }

    .handoff-contact-row,
    .offer-set-components {
        grid-template-columns: 1fr;
    }

    .handoff-lot-choices {
        grid-template-columns: 1fr;
    }

    .app-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }

    .buyer-card-dialog {
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 12px);
        margin: auto 0 0;
        border-radius: 20px 20px 0 0;
    }

    .manager-summary {
        grid-template-columns: 1fr;
    }

    .transcript-message {
        max-width: 95%;
    }

    .criterion-row {
        grid-template-columns: 1fr auto;
    }

    .criterion-value {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .recommendation-topline {
        flex-wrap: wrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
