/* ============================================================
   VU AI Agent — Chat UI Styles
   Light theme — matches Vista Urbana vu_style.css design system.
   Scoped to .vu-chat; property card styles scoped to .vu-component.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
  --vu-bg:            #ffffff;
  --vu-surface:       #ffffff;
  --vu-surface-2:     #f7f7f7;
  --vu-surface-3:     #f0f0f0;
  --vu-border:        #e6e6e6;
  --vu-text:          #0a0a0a;
  --vu-text-muted:    #666666;
  --vu-text-soft:     #444444;
  --vu-accent:        #111111;
  --vu-accent-hover:  #333333;
  --vu-accent-dim:    rgba(0,0,0,0.05);
  --vu-on-accent:     #ffffff;   /* text/icon colour on --vu-accent backgrounds */
  --vu-user-bubble:   #f4f4f4;
  --vu-green:         #10b981;
  --vu-yellow:        #d97706;
  --vu-red:           #dc2626;
  --vu-radius:        12px;
  --vu-radius-sm:     8px;
  --vu-radius-xs:     4px;
  --vu-shadow:        0 2px 12px rgba(0,0,0,0.06);
  /* Badge semantic tokens — dark-overrideable */
  --badge-sale-bg:    #111111;
  --badge-sale-text:  #ffffff;
  --badge-rent-bg:    #4a4a4a;
  --badge-rent-text:  #ffffff;
}

/* ============================================================
   Dark mode — overrides all :root tokens for every chat
   surface. Triggered by html[data-theme="dark"] (VU toggle).
   ============================================================ */
html[data-theme="dark"] .vu-chat,
html[data-theme="dark"] .vu-shell,
html[data-theme="dark"] .vu-component,
html[data-theme="dark"] .vu-sidebar,
html[data-theme="dark"] .vu-map-panel,
html[data-theme="dark"] .vu-slash-picker,
html[data-theme="dark"] .vu-typing,
html[data-theme="dark"] .vu-tool-loading,
html[data-theme="dark"] .vu-welcome {
  --vu-bg:            #000000;
  --vu-surface:       #0b0b0b;
  --vu-surface-2:     #141414;
  --vu-surface-3:     #1c1c1c;
  --vu-border:        #222222;
  --vu-text:          #e6e6e6;
  --vu-text-muted:    #a3a3a3;
  --vu-text-soft:     #cccccc;
  --vu-accent:        #ffffff;
  --vu-accent-hover:  #e0e0e0;
  --vu-accent-dim:    rgba(255,255,255,0.06);
  --vu-on-accent:     #000000;
  --vu-user-bubble:   #1a1a1a;
  --vu-green:         #34d399;
  --vu-yellow:        #fbbf24;
  --vu-red:           #f87171;
  --vu-shadow:        0 2px 12px rgba(0,0,0,0.4);
  --badge-sale-bg:    #e6e6e6;
  --badge-sale-text:  #000000;
  --badge-rent-bg:    #888888;
  --badge-rent-text:  #000000;
}

/* ============================================================
   Chat Container
   ============================================================ */
.vu-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-width: 800px;
  margin: 0 auto;
  background: var(--vu-bg);
  font-family: "Inter", "Helvetica Neue", Arial, system-ui, sans-serif;
  font-weight: 300;
  color: var(--vu-text);
  font-size: 14px;
  line-height: 1.6;
}

/* Full-page layout when used as a dedicated /chat page */
.vu-chat-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============================================================
   Header
   ============================================================ */
.vu-chat__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--vu-border);
  background: var(--vu-surface);
  flex-shrink: 0;
}

.vu-chat__header-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--vu-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--vu-on-accent);
  flex-shrink: 0;
}

.vu-chat__header-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--vu-text);
}

.vu-chat__header-subtitle {
  font-size: 11px;
  color: var(--vu-text-muted);
}

.vu-chat__header-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--vu-green);
  margin-left: auto;
}

/* ============================================================
   Messages Area
   ============================================================ */
.vu-chat__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.vu-chat__messages::-webkit-scrollbar { width: 4px; }
.vu-chat__messages::-webkit-scrollbar-track { background: transparent; }
.vu-chat__messages::-webkit-scrollbar-thumb { background: var(--vu-border); border-radius: 2px; }

/* ============================================================
   Message Rows
   ============================================================ */
.vu-message {
  display: flex;
  gap: 10px;
  max-width: 88%;
}

.vu-message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.vu-message--agent {
  align-self: flex-start;
}

.vu-message__avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 2px;
}

.vu-message--user .vu-message__avatar  { background: var(--vu-surface-3); color: var(--vu-text-muted); }
.vu-message--agent .vu-message__avatar { background: var(--vu-accent);    color: var(--vu-on-accent); }

.vu-message__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

/* ============================================================
   Bubbles
   ============================================================ */
.vu-message__bubble {
  padding: 11px 15px;
  border-radius: var(--vu-radius);
  line-height: 1.6;
  word-break: break-word;
}

.vu-message--user .vu-message__bubble {
  background: var(--vu-user-bubble);
  border: 1px solid var(--vu-border);
  border-bottom-right-radius: var(--vu-radius-xs);
  color: var(--vu-text);
}

.vu-message--agent .vu-message__bubble {
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-bottom-left-radius: var(--vu-radius-xs);
  color: var(--vu-text);
}

/* ============================================================
   Typing / Loading States
   ============================================================ */
.vu-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 11px 15px;
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius);
  border-bottom-left-radius: var(--vu-radius-xs);
  width: fit-content;
}

.vu-typing span {
  width: 6px;
  height: 6px;
  background: var(--vu-text-muted);
  border-radius: 50%;
  animation: vu-bounce 1.2s ease-in-out infinite;
}
.vu-typing span:nth-child(2) { animation-delay: 0.2s; }
.vu-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes vu-bounce {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.6; }
  30%            { transform: translateY(-5px); opacity: 1;   }
}

.vu-tool-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--vu-text-soft);
  background: var(--vu-surface-2);
  border: 1px solid var(--vu-border);
  border-radius: 20px;
  padding: 5px 12px 5px 8px;
}

.vu-tool-loading::before {
  content: '';
  width: 13px;
  height: 13px;
  border: 2px solid var(--vu-border);
  border-top-color: var(--vu-accent);
  border-radius: 50%;
  animation: vu-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes vu-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Slash Command Picker
   ============================================================ */
.vu-slash-picker {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  overflow: hidden;
  margin-bottom: 6px;
  z-index: 100;
}

.vu-slash-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--vu-border);
  transition: background 0.1s;
}

.vu-slash-item:last-child { border-bottom: none; }

.vu-slash-item--active,
.vu-slash-item:hover {
  background: var(--vu-surface-2);
}

.vu-slash-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.vu-slash-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--vu-text);
  flex-shrink: 0;
}

.vu-slash-desc {
  font-size: 12px;
  color: var(--vu-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   Input Area
   ============================================================ */
.vu-chat__input-area {
  position: relative;
  padding: 12px 16px 20px;
  border-top: 1px solid var(--vu-border);
  background: var(--vu-bg);
  flex-shrink: 0;
}

.vu-chat__input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: 24px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.2s;
}

.vu-chat__input-row:focus-within {
  border-color: var(--vu-accent);
}

.vu-chat__textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--vu-text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  padding: 4px 0;
}

.vu-chat__textarea::placeholder { color: var(--vu-text-muted); }
.vu-chat__textarea:disabled     { opacity: 0.5; cursor: not-allowed; }

.vu-chat__send {
  width: 36px;
  height: 36px;
  background: var(--vu-accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}

.vu-chat__send:hover:not(:disabled) {
  background: var(--vu-accent-hover);
  transform: scale(1.05);
}

.vu-chat__send:disabled {
  background: var(--vu-surface-3);
  cursor: not-allowed;
  transform: none;
}

.vu-chat__send svg {
  width: 16px;
  height: 16px;
  fill: white;
}

.vu-chat__hint {
  font-size: 11px;
  color: var(--vu-text-muted);
  text-align: center;
  margin-top: 8px;
}

/* ============================================================
   Welcome / Empty State
   ============================================================ */
.vu-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  gap: 12px;
}

.vu-welcome__icon {
  font-size: 36px;
  margin-bottom: 4px;
}

.vu-welcome__title {
  font-size: 18px;
  font-weight: 600;
}

.vu-welcome__subtitle {
  color: var(--vu-text-muted);
  font-size: 13px;
  max-width: 320px;
}

.vu-welcome__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
}

.vu-welcome__chip {
  background: var(--vu-surface-2);
  border: 1px solid var(--vu-border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--vu-text-soft);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.vu-welcome__chip:hover {
  background: var(--vu-accent-dim);
  border-color: var(--vu-accent);
  color: var(--vu-text);
}

/* ============================================================
   Rich UI Components (SSR injected via x-html)
   ============================================================ */
.vu-component {
  background: var(--vu-surface-2);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius);
  padding: 16px;
  overflow: hidden;
  box-shadow: var(--vu-shadow);
}

.component-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.component-icon { font-size: 14px; }

/* ── Listing Grid — horizontal scroll carousel ── */
.listing-grid__items {
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.listing-grid__items::-webkit-scrollbar { height: 3px; }
.listing-grid__items::-webkit-scrollbar-track { background: transparent; }
.listing-grid__items::-webkit-scrollbar-thumb { background: var(--vu-border); border-radius: 2px; }

/* ── Property Card v2 ── */
.prop-card-v2 {
  flex: 0 0 210px;
  border-radius: var(--vu-radius);
  overflow: hidden;
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  box-shadow: inset 0 3px 0 0 var(--vu-accent);
  transition: transform 0.2s;
  scroll-snap-align: start;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
}
.prop-card-v2:hover { transform: translateY(-2px); }

.prop-card-v2__image {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--vu-surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--vu-text-muted);
  font-size: 28px;
  position: relative;
}
.prop-card-v2__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Type tag — semi-transparent overlay, readable on any photo */
.prop-card-v2__type-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  background: var(--vu-text-secondary);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--vu-bg);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.prop-card-v2__body   { padding: 10px 12px 12px; }
.prop-card-v2__price  { font-size: 18px; font-weight: 600; color: var(--vu-text); letter-spacing: -0.02em; margin-bottom: 2px; }
.prop-card-v2__price-sub { font-size: 11px; font-weight: 400; color: var(--vu-text-muted); }
.prop-card-v2__address { font-size: 12px; color: var(--vu-text-muted); line-height: 1.4; margin: 6px 0; word-wrap: break-word; }
.prop-card-v2__specs  { display: flex; gap: 10px; font-size: 11px; color: var(--vu-text-muted); flex-wrap: wrap; }
.prop-card-v2__spec   { display: inline-flex; align-items: center; gap: 3px; }

/* Placeholder when image is absent or fails to load */
.prop-card-v2__image:not(:has(img))::before,
.prop-card-v2__image:has(img[style*="display:none"])::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    var(--vu-surface-3)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23bbbbbb' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9.5L12 3l9 6.5V21H3V9.5z'/%3E%3Cpath d='M9 21V12h6v9'/%3E%3C/svg%3E")
    center / 36px no-repeat;
}

.empty-state {
  color: var(--vu-text-muted);
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

/* ── Metric Card v2 ── */
.metric-card-v2 {
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius);
  overflow: hidden;
}
.metric-card-v2__header {
  padding: 11px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--vu-border);
}
.metric-card-v2__title {
  font-size: 10px;
  font-weight: 600;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.metric-card-v2__tags { display: flex; gap: 4px; flex-wrap: wrap; }
.metric-tag {
  font-size: 10px;
  color: var(--vu-text-muted);
  font-weight: 500;
  padding: 2px 7px;
  border: 1px solid var(--vu-border);
  border-radius: 3px;
  letter-spacing: 0.03em;
}
.metric-grid-v2 { display: grid; grid-template-columns: 1fr 1fr; }
.metric-cell {
  padding: 14px 16px;
  border-right: 1px solid var(--vu-border);
  border-bottom: 1px solid var(--vu-border);
}
.metric-cell:nth-child(even) { border-right: none; }
.metric-cell:nth-last-child(-n+2) { border-bottom: none; }
.metric-cell__val {
  font-size: 22px;
  font-weight: 600;
  color: var(--vu-text);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 5px;
}
.metric-cell__label {
  font-size: 10px;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── GIS Score v2 ── */
.gis-v2 {
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius);
  overflow: hidden;
}
.gis-v2__header {
  padding: 11px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--vu-border);
}
.gis-v2__title {
  font-size: 10px;
  font-weight: 600;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.gis-v2__body { padding: 12px 14px 2px; display: flex; flex-direction: column; gap: 10px; }
.gis-v2__row  { display: grid; grid-template-columns: 108px 1fr 64px; align-items: center; gap: 10px; }
.gis-v2__row-label { font-size: 10px; color: var(--vu-text-muted); text-align: right; white-space: nowrap; }
.gis-v2__track { height: 6px; background: var(--vu-surface-3); border-radius: 3px; overflow: hidden; }
.gis-v2__fill  { height: 100%; background: var(--vu-accent); opacity: 0.5; border-radius: 3px; transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }
.gis-v2__fill--top   { opacity: 1; }
.gis-v2__fill--green { background: var(--vu-green); }
.gis-v2__row-val { font-size: 10px; font-weight: 600; color: var(--vu-text); text-align: right; white-space: nowrap; }
.gis-v2__footer {
  margin: 12px 14px 0;
  padding: 10px 0 12px;
  border-top: 1px solid var(--vu-border);
  font-size: 10px;
  color: var(--vu-text-muted);
  display: flex;
  justify-content: space-between;
}

/* ── Chart Bar v2 ── */
.chart-v2 {
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius);
  overflow: hidden;
}
.chart-v2__header {
  padding: 11px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--vu-border);
}
.chart-v2__title {
  font-size: 10px;
  font-weight: 600;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.chart-v2__body { padding: 12px 14px 2px; display: flex; flex-direction: column; gap: 10px; }
.chart-v2__row  { display: grid; grid-template-columns: 82px 1fr 22px; align-items: center; gap: 10px; }
.chart-v2__row-label {
  font-size: 10px;
  color: var(--vu-text-muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-v2__track { height: 6px; background: var(--vu-surface-3); border-radius: 3px; overflow: hidden; }
.chart-v2__fill  { height: 100%; background: var(--vu-accent); opacity: 0.45; border-radius: 3px; transition: width 0.6s cubic-bezier(0.16,1,0.3,1); }
.chart-v2__row--peak .chart-v2__fill { opacity: 1; }
.chart-v2__row-val { font-size: 11px; font-weight: 600; color: var(--vu-text); text-align: right; }
.chart-v2__footer {
  margin: 12px 14px 0;
  padding: 10px 0 12px;
  border-top: 1px solid var(--vu-border);
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--vu-text-muted);
}

/* ── Data Table v2 ── */
.table-v2 {
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius);
  overflow: hidden;
}
.table-v2__header {
  padding: 11px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--vu-border);
}
.table-v2__title {
  font-size: 10px;
  font-weight: 600;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.table-v2 table { width: 100%; border-collapse: collapse; }
.table-v2 th {
  padding: 7px 14px;
  text-align: left;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--vu-text-muted);
  background: var(--vu-surface-2);
  border-bottom: 1px solid var(--vu-border);
  white-space: nowrap;
}
.table-v2 td {
  padding: 9px 14px;
  font-size: 12px;
  color: var(--vu-text-soft);
  border-bottom: 1px solid var(--vu-border);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.table-v2 tbody tr:last-child td { border-bottom: none; }
.table-v2 tbody tr:hover td { background: var(--vu-accent-dim); }
.table-v2__chip {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border: 1px solid var(--vu-border);
  border-radius: 3px;
  color: var(--vu-text-muted);
}
.table-v2__footer {
  padding: 8px 14px;
  border-top: 1px solid var(--vu-border);
  font-size: 10px;
  color: var(--vu-text-muted);
  display: flex;
  justify-content: space-between;
  background: var(--vu-surface-2);
}

/* ── Knowledge Sources v2 ── */
.ks-v2 {
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius);
  overflow: hidden;
}
.ks-v2__header {
  padding: 11px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--vu-border);
}
.ks-v2__title {
  font-size: 10px;
  font-weight: 600;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ks-v2__item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--vu-border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ks-v2__item:last-child { border-bottom: none; }
.ks-v2__item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.ks-v2__item-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--vu-text);
  line-height: 1.4;
  flex: 1;
}
.ks-v2__item-rel {
  font-size: 10px;
  font-weight: 600;
  color: var(--vu-text-muted);
  padding: 2px 7px;
  border: 1px solid var(--vu-border);
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ks-v2__item-excerpt {
  font-size: 11px;
  color: var(--vu-text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Listing grid: borderless outer wrapper — prop-card-v2 cards are the visual element ── */
.vu-component.listing-grid {
  background: transparent;
  border-color: transparent;
  padding: 0;
  box-shadow: none;
}

/* ── NDD v2 ── */
.ndd-v2 {
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius);
  overflow: hidden;
}
.ndd-v2__header {
  padding: 11px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--vu-border);
}
.ndd-v2__title {
  font-size: 10px;
  font-weight: 600;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 5px;
}
/* Full-width muted band section dividers */
.ndd-v2__section-label {
  padding: 5px 14px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--vu-text-muted);
  background: var(--vu-surface-2);
  border-bottom: 1px solid var(--vu-border);
  border-top: 1px solid var(--vu-border);
}
/* KPI hairline grid — uses metric-cell; col variants */
.ndd-v2__kpi { display: grid; }
.ndd-v2__kpi--2 { grid-template-columns: 1fr 1fr; }
.ndd-v2__kpi--3 { grid-template-columns: 1fr 1fr 1fr; }
.ndd-v2__kpi--2 .metric-cell:nth-child(even)     { border-right: none; }
.ndd-v2__kpi--2 .metric-cell:nth-last-child(-n+2) { border-bottom: none; }
.ndd-v2__kpi--3 .metric-cell:nth-child(3n)        { border-right: none; }
.ndd-v2__kpi--3 .metric-cell:last-child           { border-bottom: none; }
/* GIS rows — reuses gis-v2__row; wrap in padding */
.ndd-v2__gis { padding: 12px 14px 2px; display: flex; flex-direction: column; gap: 10px; }
.ndd-v2__footer {
  margin: 0 14px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--vu-border);
  font-size: 10px;
  color: var(--vu-text-muted);
}

/* ── Alert v2 ── */
.alert-v2 {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--vu-radius);
  background: var(--vu-surface-2);
  border: 1px solid var(--vu-border);
  border-left-width: 3px;
  font-size: 13px;
  line-height: 1.5;
}
.alert-v2--info    { border-left-color: var(--vu-border); }
.alert-v2--warning { border-left-color: var(--vu-yellow); }
.alert-v2--error   { border-left-color: var(--vu-red); }
.alert-v2--success { border-left-color: var(--vu-green); }
.alert-v2__icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-v2--info    .alert-v2__icon { color: var(--vu-text-muted); }
.alert-v2--warning .alert-v2__icon { color: var(--vu-yellow); }
.alert-v2--error   .alert-v2__icon { color: var(--vu-red); }
.alert-v2--success .alert-v2__icon { color: var(--vu-green); }
.alert-v2__body    { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.alert-v2__message { color: var(--vu-text); }
.alert-v2__action  {
  font-size: 12px;
  font-weight: 500;
  color: var(--vu-accent);
  text-decoration: underline;
  cursor: pointer;
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ============================================================
   Mobile & Native-App Feel
   iOS safe areas, 44px touch targets, no zoom, momentum scroll
   ============================================================ */

/* ── Ionic Icons — size + alignment ── */
ion-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  pointer-events: none;
  font-size: inherit;
  line-height: 1;
}

.vu-chat__header-avatar ion-icon  { font-size: 15px; color: var(--vu-on-accent); }
.vu-message__avatar ion-icon      { font-size: 14px; }
.component-icon ion-icon          { font-size: 14px; }
.vu-slash-icon ion-icon           { font-size: 16px; }
.alert-v2__icon ion-icon          { font-size: 16px; }
.vu-welcome__icon ion-icon        { font-size: 36px; color: var(--vu-text-muted); }
.vu-welcome__chip ion-icon        { font-size: 13px; margin-right: 4px; color: var(--vu-text-muted); }
.vu-chat__send ion-icon           { font-size: 18px; color: var(--vu-on-accent); }
.vu-map-toggle ion-icon           { font-size: 16px; }
.vu-map-panel__title ion-icon     { font-size: 15px; }
.vu-map-panel__collapse ion-icon  { font-size: 16px; }
/* v2 component title icons */
.metric-card-v2__title ion-icon,
.ndd-v2__title ion-icon,
.gis-v2__title ion-icon,
.chart-v2__title ion-icon,
.table-v2__title ion-icon,
.ks-v2__title ion-icon { font-size: 12px; }

/* Replace old SVG rule */
.vu-chat__send svg { display: none; }

/* Prevent iOS double-tap zoom on buttons */
* { -webkit-tap-highlight-color: transparent; }

/* Momentum scrolling on the messages area */
.vu-chat__messages {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Horizontal property-card strip — touch scroll */
.listing-grid__items {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* iOS safe area: pad the input area so it clears the home indicator */
.vu-chat__input-area {
  padding-bottom: max(20px, calc(12px + env(safe-area-inset-bottom)));
}

/* Ensure send button always meets 44×44 tap target */
.vu-chat__send {
  width: 44px;
  height: 44px;
}

@media (max-width: 600px) {
  /* Lock the chat to the dynamic viewport height so the flex column never overflows.
     dvh updates when the on-screen keyboard appears/disappears, keeping the input in view. */
  .vu-chat {
    max-width: 100%;
    border-radius: 0;
    height: 100dvh;          /* override parent's 100% — use actual viewport */
    max-height: 100dvh;
    overflow: hidden;        /* nothing can scroll out of this box */
  }

  /* Messages fill remaining space and scroll internally */
  .vu-chat__messages {
    flex: 1 1 0;             /* critical: allow shrink below content size */
    min-height: 0;
    overflow-y: auto;
    padding: 16px 12px;
    gap: 16px;
  }

  /* Input area stays glued to the bottom — never scrolls */
  .vu-chat__input-area {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 10px 12px max(16px, calc(8px + env(safe-area-inset-bottom)));
  }

  /* Prevent iOS textarea zoom (requires ≥16px font) */
  .vu-chat__textarea {
    font-size: 16px;
  }

  /* Messages can use more width on small screens */
  .vu-message {
    max-width: 96%;
  }

  /* Chips wrap more tightly */
  .vu-welcome__chips {
    gap: 6px;
  }

  .vu-welcome__chip {
    font-size: 13px;
    padding: 8px 14px;
  }

  /* Property cards: narrower on mobile so 1.5 are visible = clear swipeable hint */
  .vu-component .prop-card-v2 {
    flex: 0 0 180px;
  }

  /* Component block full-width, no side padding */
  .vu-component {
    padding: 12px;
  }

  /* Listing grid stays borderless on mobile too */
  .vu-component.listing-grid {
    padding: 0;
  }

  /* Data table: restore flush edges on mobile */
  .vu-component.data-table {
    padding: 12px 12px 0;
  }

  .vu-component.data-table .table-wrapper {
    margin: 12px -12px 0;
  }
}

/* ============================================================
   Conversation Sidebar
   ============================================================ */

/* Outer shell: sidebar + chat side by side */
.vu-shell {
  display: flex;
  height: 100dvh;
  overflow: hidden;
  background: var(--vu-bg);
  font-family: "Inter", "Helvetica Neue", Arial, system-ui, sans-serif;
}

/* Make .vu-chat fill remaining space inside the shell */
.vu-shell .vu-chat {
  flex: 1;
  min-width: 0;
  max-width: none;
  margin: 0;
  height: 100%;
}

.vu-map-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--vu-border);
  background: var(--vu-surface);
  color: var(--vu-text);
  border-radius: var(--vu-radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.vu-map-toggle:hover {
  background: var(--vu-surface-2);
  border-color: var(--vu-accent);
}

.vu-map-panel {
  width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--vu-surface);
  border-left: 1px solid transparent;
  transition: width 0.28s ease, opacity 0.2s ease;
}

.vu-map-panel--open {
  width: min(38vw, 520px);
  min-width: 320px;
  opacity: 1;
  pointer-events: auto;
  border-left-color: var(--vu-border);
}

.vu-map-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--vu-border);
  flex-shrink: 0;
}

.vu-map-panel__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--vu-text);
}

.vu-map-panel__collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius-sm);
  background: var(--vu-surface);
  color: var(--vu-text-muted);
  cursor: pointer;
}

.vu-map-panel__collapse:hover {
  background: var(--vu-surface-2);
  color: var(--vu-text);
}

.vu-map-panel__body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.vu-map-canvas-wrap {
  position: relative;
  height: 44%;
  min-height: 220px;
  border-bottom: 1px solid var(--vu-border);
  background: var(--vu-surface-2);
}

.vu-map-canvas {
  position: absolute;
  inset: 0;
}

.vu-map-canvas__status {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 5;
  background: var(--vu-accent);
  color: var(--vu-on-accent);
  border-radius: var(--vu-radius-sm);
  padding: 7px 10px;
  font-size: 11px;
  line-height: 1.3;
  backdrop-filter: blur(2px);
}

.vu-map-meta {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vu-map-meta__block {
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius-sm);
  background: var(--vu-surface-2);
  padding: 10px;
}

.vu-map-meta__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--vu-text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}

.vu-map-layer-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vu-map-pill {
  border: 1px solid var(--vu-border);
  background: var(--vu-bg);
  border-radius: 20px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--vu-text-soft);
}

.vu-map-pill--off {
  opacity: 0.65;
}

.vu-map-analysis {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: var(--vu-text-soft);
  white-space: pre-wrap;
  max-height: 160px;
  overflow: auto;
  background: var(--vu-bg);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius-xs);
  padding: 8px;
}

.vu-map-action-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
}

.vu-map-action-item {
  font-size: 12px;
  line-height: 1.4;
  color: var(--vu-text-soft);
  background: var(--vu-bg);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius-xs);
  padding: 6px 8px;
}

.vu-map-action-item__time {
  color: var(--vu-text-muted);
  font-size: 10px;
  margin-right: 6px;
}

/* ── Sidebar panel ── */
.vu-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--vu-surface-2);
  border-right: 1px solid var(--vu-border);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.vu-sidebar__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--vu-border);
  flex-shrink: 0;
}

.vu-sidebar__title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--vu-text-muted);
  flex: 1;
}

.vu-sidebar__new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--vu-radius-sm);
  border: 1px solid var(--vu-border);
  background: var(--vu-bg);
  color: var(--vu-text);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.15s, border-color 0.15s;
}

.vu-sidebar__new-btn:hover {
  background: var(--vu-accent);
  border-color: var(--vu-accent);
  color: var(--vu-on-accent);
}

/* ── Search ── */
.vu-sidebar__search {
  padding: 10px 12px;
  border-bottom: 1px solid var(--vu-border);
  position: relative;
  flex-shrink: 0;
}

.vu-sidebar__search-input {
  width: 100%;
  padding: 7px 10px 7px 30px;
  border-radius: var(--vu-radius-sm);
  border: 1px solid var(--vu-border);
  background: var(--vu-bg);
  color: var(--vu-text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.vu-sidebar__search-input:focus {
  border-color: var(--vu-accent);
}

.vu-sidebar__search-icon {
  position: absolute;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--vu-text-muted);
  font-size: 14px;
  pointer-events: none;
}

/* ── Conversation list ── */
.vu-sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.vu-sidebar__empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--vu-text-muted);
}

/* ── Conversation item ── */
.vu-conv-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: var(--vu-radius-sm);
  margin: 1px 6px;
  transition: background 0.12s;
  min-width: 0;
}

.vu-conv-item:hover {
  background: var(--vu-border);
}

.vu-conv-item--active {
  background: var(--vu-surface-3);
}

.vu-conv-item__title {
  flex: 1;
  font-size: 13px;
  font-weight: 400;
  color: var(--vu-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.vu-conv-item--active .vu-conv-item__title {
  font-weight: 500;
}

.vu-conv-item__date {
  font-size: 11px;
  color: var(--vu-text-muted);
  flex-shrink: 0;
}

.vu-conv-item__delete {
  display: none;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: var(--vu-radius-xs);
  border: none;
  background: transparent;
  color: var(--vu-text-muted);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  padding: 0;
}

.vu-conv-item:hover .vu-conv-item__delete {
  display: flex;
}

.vu-conv-item__delete:hover {
  color: var(--vu-red);
  background: rgba(220, 38, 38, 0.08);
}

/* ============================================================
   Agentic Step Timeline — Option C collapsible
   ============================================================ */

/* Step chip — used in collapsed header row */
.step-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  border: 1px solid var(--vu-border);
  border-radius: 20px;
  color: var(--vu-text-muted);
  background: var(--vu-surface-2);
  white-space: nowrap;
}
.step-chip--done   { color: var(--vu-text); }
.step-chip--active {
  color: var(--vu-accent);
  border-color: var(--vu-accent);
  background: var(--vu-accent-dim);
}
.step-chip ion-icon { font-size: 11px; }

/* Collapse / expand trigger row (shown after done, multi-step) */
.steps-collapse-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--vu-text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.steps-collapse-trigger:hover { color: var(--vu-text); }
.steps-collapse-trigger ion-icon { font-size: 14px; flex-shrink: 0; }
.steps-collapse-chips { display: flex; gap: 5px; flex-wrap: wrap; }

/* Streaming timeline */
.steps-timeline { display: flex; flex-direction: column; gap: 0; margin-bottom: 4px; }
.steps-timeline__step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0 10px;
  position: relative;
}
.steps-timeline__step:not(:last-child) .steps-timeline__line::after {
  content: '';
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: -4px;
  width: 1px;
  background: var(--vu-border);
}
.steps-timeline__line {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 4px;
}
.steps-timeline__dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--vu-border);
  background: var(--vu-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--vu-text-muted);
  flex-shrink: 0;
  z-index: 1;
}
.steps-timeline__dot--done {
  background: var(--vu-accent);
  border-color: var(--vu-accent);
  color: var(--vu-on-accent);
}
.steps-timeline__dot--active {
  border-color: var(--vu-accent);
  color: var(--vu-accent);
  animation: vu-pulse-border 1.4s ease infinite;
}
@keyframes vu-pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 var(--vu-accent-dim); }
  50%       { box-shadow: 0 0 0 4px var(--vu-accent-dim); }
}
.steps-timeline__content { padding: 2px 0 16px; }
.steps-timeline__tool-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.steps-timeline__tool-label--active { color: var(--vu-accent); }
.steps-timeline__pending {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--vu-text-muted);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius-sm);
  padding: 6px 10px;
  background: var(--vu-surface-2);
}
.steps-timeline__pending::before {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--vu-border);
  border-top-color: var(--vu-accent);
  animation: vu-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ── Sidebar toggle (hamburger) — desktop hidden, mobile visible ── */
.vu-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  color: var(--vu-text);
  cursor: pointer;
  font-size: 22px;
  border-radius: var(--vu-radius-sm);
  flex-shrink: 0;
}

.vu-sidebar-toggle:hover {
  background: var(--vu-border);
}

/* ── Mobile: sidebar becomes an overlay drawer ── */
@media (max-width: 700px) {
  .vu-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 80vw;
    max-width: 300px;
    z-index: 200;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }

  .vu-sidebar--open {
    transform: translateX(0);
  }

  .vu-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 199;
    backdrop-filter: blur(2px);
  }

  .vu-sidebar-overlay--visible {
    display: block;
  }

  .vu-sidebar-toggle {
    display: flex;
  }

  .vu-map-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 84vw;
    max-width: 390px;
    min-width: 0;
    transform: translateX(100%);
    opacity: 1;
    pointer-events: auto;
    z-index: 210;
    box-shadow: -4px 0 24px rgba(0,0,0,0.14);
    border-left-color: var(--vu-border);
    transition: transform 0.25s ease;
  }

  .vu-map-panel--open {
    width: 84vw;
    min-width: 0;
    transform: translateX(0);
  }
}

/* ============================================================
   V1 Component Compatibility Layer — UI-only
   These classes are used in the new_ai_chat.html static demo
   preview snippets (inline JS template literals, lines ~921-929).
   They are NOT emitted by the vu-ai-agent SSR renderer — the
   agent now emits v2 classes exclusively. Do not remove this
   block until new_ai_chat.html preview snippets are updated.
   ============================================================ */

/* ── Property Card v1 ── */
.vu-component .property-card {
  flex: 0 0 220px;
  border-radius: var(--vu-radius);
  overflow: hidden;
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  box-shadow: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  scroll-snap-align: start;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.vu-component .property-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  text-decoration: none;
}

.vu-component .property-image-container {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--vu-surface-3);
}

.vu-component .property-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vu-component .property-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: var(--vu-radius-xs);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--vu-on-accent);
}

.vu-component .property-badge--venda,
.vu-component .property-badge--sale   { background-color: #3b82f6; color: #ffffff; }
.vu-component .property-badge--aluguel,
.vu-component .property-badge--rent   { background-color: #10b981; color: #ffffff; }

.vu-component .property-details { padding: 10px 12px 12px; }

.vu-component .property-price {
  font-size: 17px;
  font-weight: 600;
  color: var(--vu-text);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.vu-component .property-address {
  font-size: 12px;
  color: var(--vu-text-muted);
  line-height: 1.4;
  margin-bottom: 6px;
  word-wrap: break-word;
}

.vu-component .property-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 11px;
  color: var(--vu-text-muted);
}

.vu-component .property-info span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

@media (max-width: 600px) {
  .vu-component .prop-card-v2 { flex: 0 0 180px; }
}

/* ── Metric Card v1 ── */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius-sm);
  text-align: center;
}

.metric-value {
  font-size: 20px;
  font-weight: 600;
  color: var(--vu-text);
}

.metric-label {
  font-size: 10px;
  color: var(--vu-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Score / GIS v1 ── */
.score-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.score-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.score-item--wide { margin-top: 4px; }

.score-label {
  font-size: 12px;
  color: var(--vu-text-soft);
  font-weight: 500;
}

.score-bar-track {
  width: 100%;
  height: 6px;
  background: var(--vu-surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  background: var(--vu-accent);
  border-radius: 3px;
  transition: width 0.6s ease;
}

.score-bar-fill--green { background: var(--vu-green); }

.score-value {
  font-size: 16px;
  font-weight: 600;
}

.score-unit {
  font-size: 11px;
  font-weight: 400;
  color: var(--vu-text-muted);
}

.gisrank-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 6px;
}

.gisrank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius-sm);
  padding: 8px 10px;
}

.gisrank-icon  { font-size: 14px; }
.gisrank-label { font-size: 11px; color: var(--vu-text-muted); flex: 1; }
.gisrank-value { font-size: 14px; font-weight: 600; }

/* ── Bar Chart v1 ── */
.chart-container {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 110px;
  padding-bottom: 4px;
}

.bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
  gap: 4px;
  justify-content: flex-end;
}

.bar-count {
  font-size: 10px;
  color: var(--vu-text-muted);
}

.bar {
  width: 100%;
  background: var(--vu-accent);
  border-radius: var(--vu-radius-xs) var(--vu-radius-xs) 0 0;
  min-height: 4px;
  transition: opacity 0.2s;
}

.bar:hover { opacity: 0.8; }

.bar-label {
  font-size: 9px;
  color: var(--vu-text-muted);
  text-align: center;
  word-break: break-all;
  line-height: 1.2;
}

.chart-footnote {
  font-size: 11px;
  color: var(--vu-text-muted);
  margin-top: 8px;
  text-align: right;
}

/* ── Data Table v1 ── */
.table-wrapper { overflow-x: auto; }

.vu-component table { width: 100%; border-collapse: collapse; font-size: 12px; }

.vu-component th {
  background: var(--vu-surface);
  padding: 8px 10px;
  text-align: left;
  color: var(--vu-text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.vu-component td {
  padding: 8px 10px;
  border-top: 1px solid var(--vu-border);
  color: var(--vu-text-soft);
  white-space: nowrap;
}

.vu-component tr:hover td { background: var(--vu-surface); }

.table-footnote {
  font-size: 11px;
  color: var(--vu-text-muted);
  margin-top: 8px;
  text-align: center;
}

/* ── Knowledge Sources v1 ── */
.knowledge-sources__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.knowledge-source-card {
  background: var(--vu-surface);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius-sm);
  padding: 10px 12px;
}

.knowledge-source-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.knowledge-source-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--vu-text);
  line-height: 1.3;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-source-relevance {
  font-size: 10px;
  font-weight: 500;
  color: var(--vu-accent);
  background: var(--vu-accent-dim);
  padding: 2px 6px;
  border-radius: var(--vu-radius-xs);
  white-space: nowrap;
  flex-shrink: 0;
}

.knowledge-source-id {
  font-size: 10px;
  color: var(--vu-text-muted);
  margin-bottom: 6px;
}

.knowledge-source-excerpt {
  font-size: 12px;
  color: var(--vu-text-soft);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Alert v1 (bare class, no -v2 suffix) ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
}

.alert--info    { border-color: var(--vu-accent);  background: var(--vu-accent-dim); }
.alert--warning { border-color: var(--vu-yellow);  background: rgba(245,166,35,0.1); }
.alert--error   { border-color: var(--vu-red);     background: rgba(224,82,82,0.1);  }
.alert--success { border-color: var(--vu-green);   background: rgba(76,175,80,0.1);  }

.alert-icon    { font-size: 16px; flex-shrink: 0; }
.alert-message { font-size: 13px; line-height: 1.5; }

/* ── v1 ion-icon wiring ── */
.gisrank-icon ion-icon { font-size: 14px; color: var(--vu-text-muted); }
.score-label ion-icon  { font-size: 12px; margin-right: 3px; color: var(--vu-text-muted); }

/* ============================================================
   Dark mode — icon contrast fixes (UI layer)
   --vu-accent is #ffffff in dark mode. Icons inside accent-
   coloured backgrounds must flip to --vu-on-accent (#000000).
   This supplements the scoped token override above.
   ============================================================ */
html[data-theme="dark"] .vu-chat__header-avatar,
html[data-theme="dark"] .vu-chat__header-avatar ion-icon {
  color: var(--vu-on-accent);
}

html[data-theme="dark"] .vu-message--agent .vu-message__avatar {
  color: var(--vu-on-accent);
}

html[data-theme="dark"] .vu-message--agent .vu-message__avatar ion-icon {
  color: var(--vu-on-accent);
}

html[data-theme="dark"] .vu-chat__send:not(:disabled) ion-icon {
  color: var(--vu-on-accent);
}

/* ============================================================
   UI-only (#60): assistant prose markdown typography.
   The chat client now renders agent prose as sanitized HTML
   (marked + DOMPurify) into `.vu-message__bubble.vu-markdown`.
   These rules give headings / lists / blockquotes / code sane
   spacing using the existing --vu-* tokens. Design polish
   (final heading scale, code theme) is a vu-design-agent follow-up.
   NOTE: this block is UI-local — not part of the vu-ai-agent
   chat.css sync source-of-truth.
   ============================================================ */
.vu-markdown > *:first-child { margin-top: 0; }
.vu-markdown > *:last-child  { margin-bottom: 0; }
.vu-markdown h1,
.vu-markdown h2,
.vu-markdown h3,
.vu-markdown h4 {
  margin: 0.9em 0 0.4em;
  line-height: 1.25;
  font-weight: 600;
  color: var(--vu-text);
}
.vu-markdown h1 { font-size: 1.35em; }
.vu-markdown h2 { font-size: 1.2em; }
.vu-markdown h3 { font-size: 1.08em; }
.vu-markdown h4 { font-size: 1em; }
.vu-markdown p { margin: 0.5em 0; }
.vu-markdown ul,
.vu-markdown ol { margin: 0.5em 0; padding-left: 1.4em; }
.vu-markdown li { margin: 0.2em 0; }
.vu-markdown li > p { margin: 0.2em 0; }
.vu-markdown a {
  color: var(--vu-accent);
  text-decoration: underline;
}
.vu-markdown strong { font-weight: 600; }
.vu-markdown em { font-style: italic; }
.vu-markdown blockquote {
  margin: 0.6em 0;
  padding: 0.2em 0.9em;
  border-left: 3px solid var(--vu-border);
  color: var(--vu-text-secondary);
}
.vu-markdown hr {
  border: 0;
  border-top: 1px solid var(--vu-border);
  margin: 0.9em 0;
}
.vu-markdown code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--vu-surface-2);
  padding: 0.1em 0.35em;
  border-radius: var(--vu-radius-xs, 4px);
}
.vu-markdown pre {
  margin: 0.6em 0;
  padding: 0.75em 0.9em;
  background: var(--vu-surface-2);
  border: 1px solid var(--vu-border);
  border-radius: var(--vu-radius-sm, 6px);
  overflow-x: auto;
}
.vu-markdown pre code {
  background: none;
  padding: 0;
}
.vu-markdown table {
  border-collapse: collapse;
  margin: 0.6em 0;
  width: 100%;
}
.vu-markdown th,
.vu-markdown td {
  border: 1px solid var(--vu-border);
  padding: 0.35em 0.6em;
  text-align: left;
}
