:root {
  --ink: #142338;
  --muted: #607086;
  --line: #dbe2ea;
  --panel: #fff;
  --soft: #f3f6f8;
  --navy: #17324d;
  --teal: #1d7f78;
  --gold: #c9962f;
  --shadow: 0 18px 50px rgba(20, 35, 56, .12);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--soft); font-family: Arial, Helvetica, sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) 420px; align-items: center; gap: 56px; padding: clamp(24px, 6vw, 96px); background: linear-gradient(120deg, rgba(20,35,56,.88), rgba(23,50,77,.68)), url("https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?auto=format&fit=crop&w=1800&q=80") center/cover; }
.login-copy { max-width: 760px; color: #fff; }
.login-copy .eyebrow { color: #f3c66a; }
.login-copy h1 { max-width: 720px; margin: 0 0 22px; font-size: clamp(42px, 6vw, 76px); line-height: 1; letter-spacing: 0; }
.login-copy p:last-child { max-width: 640px; color: rgba(255,255,255,.84); font-size: 18px; line-height: 1.7; }
.login-card { padding: 30px; border: 1px solid rgba(255,255,255,.28); border-radius: 8px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.brand-block { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: var(--navy); font-weight: 900; }
.brand-block strong, .brand-block small { display: block; }
.brand-block small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.login-card label { margin-top: 18px; display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.login-card input, .capture-form input, .capture-form select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 13px 14px; color: var(--ink); background: #fff; }
.login-card button, .question-form button, .capture-form button { width: 100%; margin-top: 20px; border: 0; border-radius: 7px; padding: 14px 18px; color: #fff; background: var(--teal); font-weight: 800; }
.login-note { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { min-height: 100vh; padding: 24px 18px; display: flex; flex-direction: column; color: #fff; background: var(--navy); }
.sidebar .brand-block { margin-bottom: 34px; }
.sidebar .brand-mark { background: var(--teal); }
.sidebar small { color: rgba(255,255,255,.62); }
.nav-list { display: grid; gap: 7px; }
.nav-list button, .ghost-button { border: 0; border-radius: 7px; padding: 12px; color: rgba(255,255,255,.72); background: transparent; text-align: left; font-weight: 800; }
.nav-list button.active, .nav-list button:hover { color: #fff; background: rgba(255,255,255,.12); }
.sidebar-card { margin-top: auto; padding: 14px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(255,255,255,.07); }
.sidebar-card span, .sidebar-card small { display: block; color: rgba(255,255,255,.62); font-size: 11px; }
.sidebar-card strong { display: block; margin: 5px 0; }
.ghost-button { margin-top: 14px; border-top: 1px solid rgba(255,255,255,.12); border-radius: 0; }
.workspace { padding: 30px clamp(22px, 4vw, 62px) 54px; overflow: hidden; }
.topbar, .section-heading, .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar { margin-bottom: 24px; }
h2, h3 { margin: 0; letter-spacing: 0; }
.topbar h2 { font-size: clamp(24px, 3vw, 36px); }
.user-pill { min-width: 190px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.user-pill span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--gold); font-size: 12px; font-weight: 900; }
.user-pill strong, .user-pill small { display: block; font-size: 12px; }
.user-pill small { color: var(--muted); }
.view { display: none; }
.view.active { display: block; }
.assistant-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
.qa-panel, .context-panel > *, .property-card, .source-item, .audit-item { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 8px 28px rgba(20,35,56,.05); }
.qa-panel { padding: 22px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 7px; color: var(--navy); background: #fff; font-weight: 900; }
.quick-prompts { margin: 18px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.quick-prompts button, .secondary-button { border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; color: var(--navy); background: #fff; font-size: 12px; font-weight: 800; }
.question-form textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.question-tools { margin-bottom: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.question-tools label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.question-tools input, .question-tools select { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 11px 12px; color: var(--ink); background: #fff; }
.whatsapp-button { width: 100%; margin-top: 12px; border-radius: 7px; }
.whatsapp-button:disabled { opacity: .48; cursor: not-allowed; }
.chat-log { margin-top: 20px; display: grid; gap: 14px; }
.message { padding: 15px; border-radius: 8px; line-height: 1.6; }
.message.user { margin-left: 12%; color: #fff; background: var(--navy); }
.message.agent { margin-right: 8%; border: 1px solid var(--line); background: #f9fbfc; }
.message p { margin: 0 0 10px; }
.message p:last-child { margin-bottom: 0; }
.citation-list { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.context-panel { display: grid; gap: 14px; align-content: start; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; border: 0; background: transparent; box-shadow: none; }
.metric-row article { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.metric-row span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.metric-row strong { display: block; margin-top: 8px; font-size: 28px; }
.panel-card { padding: 18px; }
.panel-card p, .panel-card li { color: var(--muted); line-height: 1.6; }
.panel-card ul { margin: 0; padding-left: 18px; }
.property-grid { margin-top: 18px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.property-card { padding: 18px; }
.property-card header, .source-item header, .audit-item header { display: flex; justify-content: space-between; gap: 12px; }
.tag { display: inline-flex; align-items: center; height: 24px; border-radius: 999px; padding: 0 9px; color: #fff; background: var(--teal); font-size: 11px; font-weight: 800; white-space: nowrap; }
.tag.renta { background: var(--gold); color: var(--ink); }
.tag.construccion { background: var(--navy); }
.property-card h4, .source-item h4, .audit-item h4 { margin: 0 0 8px; font-size: 17px; }
.property-card p, .source-item p, .audit-item p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.fact-list { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.fact-list li { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.fact-list span { color: var(--muted); }
.source-list, .audit-list { margin-top: 18px; display: grid; gap: 12px; }
.source-item, .audit-item { padding: 16px; }
.source-path { margin-top: 10px; display: block; color: var(--teal); font-size: 12px; font-weight: 800; }
.capture-layout, .documents-layout { margin-top: 18px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.capture-form, .document-form, .capture-guide article, .document-status article, .catalog-table-wrap { border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 28px rgba(20,35,56,.05); }
.capture-form { padding: 20px; }
.document-form { padding: 20px; }
.form-block { padding: 16px 0; border-top: 1px solid var(--line); }
.form-block:first-child { padding-top: 0; border-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.capture-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.document-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.document-form input, .document-form select, .document-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 13px 14px; color: var(--ink); background: #fff; }
.document-form button { width: 100%; margin-top: 20px; border: 0; border-radius: 7px; padding: 14px 18px; color: #fff; background: var(--teal); font-weight: 800; }
.capture-guide, .document-status { display: grid; gap: 12px; }
.capture-guide article, .document-status article { padding: 16px; }
.capture-guide p, .capture-guide li, .document-status p { color: var(--muted); line-height: 1.6; }
.capture-guide ul { margin: 0; padding-left: 18px; }
.compact-heading { margin-top: 26px; }
.source-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.source-actions a, .source-actions button { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; color: var(--navy); background: #fff; font-size: 12px; font-weight: 800; text-decoration: none; }
.source-meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.source-meta span { padding: 4px 7px; border-radius: 999px; background: var(--soft); }
.catalog-table-wrap { margin-top: 18px; overflow-x: auto; }
.catalog-table { width: 100%; min-width: 820px; border-collapse: collapse; }
.catalog-table th, .catalog-table td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; vertical-align: top; }
.catalog-table th { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.catalog-table td strong { display: block; }
.catalog-table td small { display: block; margin-top: 3px; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; max-width: min(520px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 7px; color: #fff; background: var(--ink); opacity: 0; transform: translate(-50%, 16px); transition: .2s ease; pointer-events: none; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 980px) {
  .login-view, .app-shell, .assistant-grid, .capture-layout, .documents-layout { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .property-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .login-view { padding: 18px; }
  .login-card { padding: 22px; }
  .workspace { padding: 22px 16px 40px; }
  .topbar, .section-heading { align-items: flex-start; flex-direction: column; }
  .property-grid, .metric-row, .form-grid, .question-tools { grid-template-columns: 1fr; }
  .message.user, .message.agent { margin-left: 0; margin-right: 0; }
}
