/* ============================================================
   Sophia · sistema de diseño
   La plataforma de ventas para desarrolladores inmobiliarios.
   Paleta de materiales de obra, Fraunces para titulares, Inter para la interfaz.
   ============================================================ */
:root {
  /* Paleta Sophia: materiales de obra. Piedra 60 · Tinta 25 · Cobre 10 · Salvia 5 */
  --piedra: #E9E3D8; --piedra-clara: #F4EFE7; --tinta: #1C2333; --cobre: #B5653A; --cobre-oscuro: #8E4A26; --cobre-claro: #D9875E; --salvia: #7A8F7B;
  --bg: #E9E3D8;
  --surface: #F4EFE7;
  --surface-2: #EEE8DE;
  --field: #FCFAF6;
  --border: #D8D0C2;
  --border-strong: #C2B8A7;
  --text: #1C2333;
  --text-2: #464D5E;
  --muted: #6E6F75;
  --nav: #1C2333;
  --nav-2: #273046;
  --nav-text: #CFC8BB;
  --accent: #B5653A;
  --accent-hover: #8E4A26;
  --accent-soft: #F1E0D4;
  --link: #8E4A26;
  --ok: #4C6A4F;     --ok-soft: #E1E8DE;
  --warn: #8F6414;   --warn-soft: #F3E7CC;
  --danger: #A0392A; --danger-soft: #F4DED7;
  --info: #3D5870;   --info-soft: #E0E6EA;
  --violet: #6A5578; --violet-soft: #EAE3EC;
  --gray-soft: #E4DDD1;
  /* Gráficos: cobre resalta la serie clave; tinta y grises para el resto; salvia = positivo */
  --chart-hi: #B5653A; --chart-1: #1C2333; --chart-2: #5B6272; --chart-3: #9A9488; --chart-4: #C9C1B3; --chart-pos: #7A8F7B;
  /* Tonos de apoyo derivados (fondos suaves y bordes) */
  --cobre-soft: #F1E0D4; --cobre-line: #E2B79E; --salvia-soft: #E1E8DE; --salvia-line: #C9D6C5; --tinta-soft: #DCDDE1;
  --radius: 6px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(28,35,51,.05);
  --shadow-lg: 0 14px 34px rgba(28,35,51,.18);
  --nav-w: 232px;
  --top-h: 58px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); color: var(--text); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 650; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) 1fr; grid-template-rows: var(--top-h) 1fr; height: 100vh; }
.sidebar { grid-row: 1 / 3; background: var(--nav); color: var(--nav-text); display: flex; flex-direction: column; overflow-y: auto; }
.brand { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; color: #fff; font-weight: 700; letter-spacing: .2px; border-bottom: 1px solid rgba(255,255,255,.06); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-size: 15px; color: #fff; }
.brand small { display: block; font-weight: 500; color: var(--nav-text); font-size: 11px; }
.nav { padding: 10px 10px 24px; }
.nav-group { margin-top: 14px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px; color: #9A958B; padding: 0 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--nav-text); font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: var(--nav-2); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,92,53,.14); color: #fff; }
.nav a.active svg { color: var(--accent); }
.nav a .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; font-weight: 600; }
.nav a .soon { margin-left: auto; font-size: 10px; border: 1px solid #3A4560; border-radius: 4px; padding: 0 4px; color: #9A958B; }
.nav svg { width: 17px; height: 17px; flex: none; }
.sidebar-foot { margin-top: auto; padding: 12px 18px; font-size: 11px; color: #9A958B; border-top: 1px solid rgba(255,255,255,.06); }

.topbar { grid-column: 2; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 20px; position: relative; z-index: 20; }
.topbar .search { flex: 1; max-width: 480px; position: relative; }
.topbar .search input { width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.topbar .search input:focus { outline: none; border-color: var(--cobre); background: var(--field); box-shadow: 0 0 0 3px rgba(181,101,58,.14); }
.topbar .search svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--muted); }
.search-results { position: absolute; top: 42px; left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; padding: 6px; }
.search-results .grp { font-size: 11px; color: var(--muted); text-transform: uppercase; padding: 8px 8px 4px; letter-spacing: .6px; }
.search-results a { display: flex; justify-content: space-between; padding: 7px 8px; border-radius: 6px; color: var(--text); }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.project-switch select { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; background: #fff; font-weight: 600; max-width: 220px; }
.icon-btn { position: relative; width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 20px; border: 1px solid var(--border); cursor: pointer; background: #fff; }
.user-chip .role { font-size: 11px; color: var(--muted); }

.main { grid-column: 2; overflow-y: auto; position: relative; }
.page { padding: 22px 28px 48px; max-width: 1480px; margin: 0 auto; }
.page.full { max-width: none; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 240px; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- botones ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.dark { background: var(--nav); border-color: var(--nav); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--gray-soft); }
.btn.danger { color: var(--danger); border-color: #DDB3A8; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.xs { padding: 3px 8px; font-size: 11.5px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.btn-group button { border: 0; background: #fff; padding: 7px 12px; font-weight: 600; font-size: 12.5px; cursor: pointer; color: var(--text-2); border-right: 1px solid var(--border); }
.btn-group button:last-child { border-right: 0; }
.btn-group button.on { background: var(--nav); color: #fff; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font-weight: 600; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

/* ---------- tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { flex: 1; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .stack > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }

.kpi { padding: 14px 16px; }
.kpi .label svg { width: 15px; height: 15px; flex: none; }
.card-head > svg { width: 18px; height: 18px; }
.kpi .label { font-size: 12px; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.alert .value { color: var(--danger); }
.kpi a.kpi-link { color: inherit; display: block; }
.kpi a.kpi-link:hover { text-decoration: none; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--gray-soft); color: var(--text-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.accent { background: var(--accent-soft); color: var(--accent-hover); }
.badge.dark { background: var(--nav); color: #fff; }
.badge .dotc { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-sim { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: var(--warn-soft); color: var(--warn); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }

.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; flex: none; background: #9A958B; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }

/* ---------- tablas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover td { background: #EFE9DF; }
.table .name { font-weight: 600; color: var(--text); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table.compact td { padding: 7px 12px; }

/* ---------- filtros ---------- */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search-box { position: relative; }
.toolbar .search-box input { padding-left: 32px; min-width: 260px; }
.toolbar .search-box svg { position: absolute; left: 9px; top: 9px; width: 15px; height: 15px; color: var(--muted); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 13.5px; }
.tabs a:hover, .tabs button:hover { color: var(--text); text-decoration: none; }
.tabs .on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .n { background: var(--gray-soft); border-radius: 10px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; border-radius: 20px; border: 1px solid var(--border-strong); background: #fff; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.chip.on { background: var(--nav); border-color: var(--nav); color: #fff; }

/* ---------- formularios ---------- */
.input, select.input, textarea.input { width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: 7px; background: #fff; font-size: 13.5px; }
.input:focus { outline: none; border-color: var(--cobre); box-shadow: 0 0 0 3px rgba(181,101,58,.14); }
textarea.input { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }
.field label, .field .label { display: block; font-size: 12.5px; font-weight: 650; margin-bottom: 5px; color: var(--text); }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.switch { position: relative; width: 36px; height: 20px; display: inline-block; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #C2B8A7; border-radius: 20px; transition: .15s; cursor: pointer; }
.switch span:before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span:before { transform: translateX(16px); }

/* ---------- modal / drawer / toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(28,35,51,.42); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; animation: fade .12s; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); animation: pop .14s; }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { flex: 1; }
.modal-body { padding: 18px 20px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; }
.drawer-wrap { position: fixed; inset: 0; background: rgba(28,35,51,.3); z-index: 90; animation: fade .12s; }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(560px, 100vw); background: #fff; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .16s; }
.drawer .modal-body { max-height: none; flex: 1; }
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--nav); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-weight: 500; max-width: 560px; animation: pop .15s; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98) } }
@keyframes slide { from { transform: translateX(30px); opacity: .4 } }

.popover { position: absolute; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 60; min-width: 260px; }
.menu a, .menu button { display: flex; width: 100%; gap: 8px; align-items: center; padding: 8px 12px; color: var(--text); background: none; border: 0; text-align: left; cursor: pointer; font-size: 13.5px; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu .hdr { padding: 8px 12px 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* ---------- vacío / avisos ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--gray-soft); display: grid; place-items: center; margin: 0 auto 12px; color: var(--muted); }
.empty h3 { margin-bottom: 4px; color: var(--text); }
.empty .actions { margin-top: 14px; }
.notice { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius); background: var(--info-soft); color: #2E4458; font-size: 13px; align-items: flex-start; }
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.notice.warn { background: var(--warn-soft); color: #6B4A10; }
.notice.danger { background: var(--danger-soft); color: #6E2A1C; }
.notice.ok { background: var(--ok-soft); color: #3F5A42; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- ficha de registro (3 columnas, estilo HubSpot simplificado) ---------- */
.record { display: grid; grid-template-columns: 300px minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.record-side .card-body { padding: 14px 16px; }
.record-title { display: flex; gap: 12px; align-items: center; }
.record-title h1 { font-size: 19px; }
.quick-actions { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.quick-actions .qa { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--text-2); cursor: pointer; background: none; border: 0; width: 52px; }
.quick-actions .qa span.c { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; background: #fff; }
.quick-actions .qa:hover span.c { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.quick-actions .qa svg { width: 15px; height: 15px; }
.props { display: grid; gap: 10px; }
.prop .k { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.prop .v { font-size: 13.5px; margin-top: 1px; word-break: break-word; }
.prop .v.editable { cursor: pointer; border-radius: 4px; padding: 1px 4px; margin-left: -4px; }
.prop .v.editable:hover { background: var(--gray-soft); }
.section-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 700; margin: 4px 0 10px; display: flex; align-items: center; }
.section-title .spacer + * { text-transform: none; letter-spacing: 0; }
.assoc { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.assoc + .assoc { margin-top: 8px; }
.assoc .t { font-weight: 600; }

/* timeline */
.composer { border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.composer .tabs { margin: 0; padding: 0 8px; }
.composer textarea { border: 0; width: 100%; padding: 12px 14px; resize: vertical; min-height: 72px; outline: none; }
.composer .foot { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 10px 10px; }
.timeline { position: relative; margin-top: 16px; }
.tl-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.tl-item:before { content: ""; position: absolute; left: 15px; top: 40px; bottom: -10px; width: 2px; background: var(--border); }
.tl-item:last-child:before { display: none; }
.tl-ico { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--gray-soft); color: var(--text-2); z-index: 1; }
.tl-ico svg { width: 15px; height: 15px; }
.tl-ico.whatsapp { background: var(--salvia-soft); color: var(--ok); }
.tl-ico.messenger, .tl-ico.instagram { background: var(--info-soft); color: var(--info); }
.tl-ico.stage { background: var(--accent-soft); color: var(--accent-hover); }
.tl-ico.quote { background: var(--violet-soft); color: var(--violet); }
.tl-ico.meeting { background: var(--info-soft); color: var(--info); }
.tl-ico.task { background: var(--warn-soft); color: var(--warn); }
.tl-ico.automation { background: var(--tinta-soft); color: var(--tinta); }
.tl-body { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; }
.tl-body .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; display: flex; gap: 6px; }
.tl-body .txt { white-space: pre-wrap; word-break: break-word; }
.tl-day { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 14px 0 2px; }

/* ---------- kanban ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: calc(100vh - 230px); }
.col { flex: 0 0 268px; background: #E3DCCF; border-radius: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.col-head { padding: 11px 12px 8px; }
.col-head .t { font-weight: 700; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.col-head .s { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.col-body { padding: 4px 8px 10px; overflow-y: auto; flex: 1; min-height: 60px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.col.lost { background: #EEDFD9; }
.deal-card { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px 11px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.deal-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.deal-card.dragging { opacity: .5; }
.deal-card .n { font-weight: 650; font-size: 13px; }
.deal-card .m { font-size: 12px; color: var(--text-2); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.deal-card .f { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.deal-card .amt { font-weight: 700; font-size: 13px; margin-top: 4px; }

/* ---------- inventario ---------- */
.unit-grid { display: grid; gap: 6px; }
.unit-row { display: grid; grid-template-columns: 54px repeat(var(--cols), minmax(74px, 1fr)); gap: 6px; align-items: stretch; }
.unit-row .floor { font-size: 12px; font-weight: 700; color: var(--muted); display: grid; place-items: center; }
.unit { border-radius: 7px; padding: 7px 8px; font-size: 12px; cursor: pointer; border: 1px solid transparent; line-height: 1.3; }
.unit:hover { filter: brightness(.96); border-color: rgba(0,0,0,.12); }
.unit .c { font-weight: 700; }
.unit .p { font-size: 11px; opacity: .85; }
.u-disponible { background: #FCFAF6; color: #3F5A42; }
.u-apartada { background: #F1E0D4; color: #8E4A26; }
.u-reservada { background: #E8C7B2; color: #6E3416; }
.u-vendida { background: #DCE5DA; color: #3F5A42; }
.u-entregada { background: #E1DDD5; color: #5A5A5A; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- barras y gráficos simples ---------- */
.bar { height: 8px; background: var(--gray-soft); border-radius: 4px; overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 70px; gap: 10px; align-items: center; margin-bottom: 8px; font-size: 13px; }
.funnel-row .track { height: 26px; background: var(--gray-soft); border-radius: 6px; overflow: hidden; }
.funnel-row .fill { height: 100%; background: linear-gradient(90deg, var(--accent), #D9875E); border-radius: 6px; display: flex; align-items: center; padding-left: 8px; color: #fff; font-weight: 700; font-size: 12px; min-width: 28px; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.spark i { flex: 1; background: #D9A98E; border-radius: 3px 3px 0 0; min-height: 2px; }
.spark i:last-child { background: var(--accent); }

/* ---------- bandeja ---------- */
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 300px; height: calc(100vh - var(--top-h)); background: #fff; }
.inbox-list { border-right: 1px solid var(--border); overflow-y: auto; }
.inbox-thread { display: flex; flex-direction: column; min-width: 0; background: #EDE7DC; }
.inbox-side { border-left: 1px solid var(--border); overflow-y: auto; padding: 16px; }
.conv { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; }
.conv:hover { background: var(--surface-2); }
.conv.on { background: var(--accent-soft); }
.conv .who { font-weight: 650; display: flex; gap: 6px; align-items: center; }
.conv .last { font-size: 12.5px; color: var(--text-2); }
.conv.unread .who:after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 68%; padding: 8px 12px; border-radius: 12px; background: #fff; border: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; }
.msg.out { align-self: flex-end; background: #E3E9DE; border-color: #C9D6C5; }
.msg.bot { align-self: flex-end; background: #E0E6EA; border-color: #D5DEE5; }
.msg.note { align-self: center; background: var(--warn-soft); border-color: #E7D3A8; font-size: 12.5px; max-width: 80%; }
.msg .meta { font-size: 10.5px; color: var(--muted); margin-top: 3px; text-align: right; }
.reply { border-top: 1px solid var(--border); background: #fff; padding: 10px 14px; }
.reply textarea { width: 100%; border: 1px solid var(--border-strong); border-radius: 8px; padding: 9px 11px; resize: none; min-height: 60px; }
.ch-ico { width: 18px; height: 18px; border-radius: 5px; display: inline-grid; place-items: center; color: #fff; flex: none; }
.ch-ico svg { width: 11px; height: 11px; }
.ch-whatsapp { background: #25d366; } .ch-messenger { background: #0084ff; } .ch-instagram { background: #d6249f; } .ch-web { background: #5B6272; }

/* ---------- agenda ---------- */
.cal { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--field); overflow: hidden; }
.cal .h { padding: 8px; font-size: 12px; font-weight: 700; text-align: center; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal .h.today { color: var(--accent); }
.cal .t { font-size: 11px; color: var(--muted); text-align: right; padding: 2px 6px; border-right: 1px solid var(--border); height: 52px; }
.cal .cell { border-right: 1px solid var(--border); border-bottom: 1px solid var(--surface-2); height: 52px; position: relative; padding: 2px; }
.cal .ev { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; font-size: 11px; color: #fff; overflow: hidden; cursor: pointer; z-index: 1; line-height: 1.25; }

/* ---------- misc ---------- */
.kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; font-family: ui-monospace, monospace; }
.code-box { background: #1C2333; color: #E9E3D8; padding: 12px 14px; border-radius: 8px; font-family: ui-monospace, monospace; font-size: 12px; overflow-x: auto; white-space: pre; }
.steps { display: flex; gap: 0; align-items: stretch; overflow-x: auto; }
.step { flex: 1; min-width: 110px; padding: 9px 10px; font-size: 12px; font-weight: 600; background: var(--gray-soft); color: var(--text-2); position: relative; margin-right: 4px; cursor: pointer; text-align: center; }
.step:first-child { border-radius: 8px 0 0 8px; }
.step:last-child { border-radius: 0 8px 8px 0; margin-right: 0; }
.step.done { background: #EBD3C4; color: #6E3416; }
.step.cur { background: var(--accent); color: #fff; }
.step.lost { background: var(--danger-soft); color: var(--danger); }
.step:hover:not(.cur) { filter: brightness(.96); }
.ad-preview { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; }
.ad-preview .img { display: grid; place-items: center; color: #fff; padding: 18px; text-align: center; font-weight: 800; font-size: 18px; position: relative; }
.ad-preview .img .logo { position: absolute; top: 10px; left: 12px; font-size: 11px; font-weight: 700; background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 4px; }
.ad-preview .img .price { position: absolute; bottom: 10px; right: 12px; font-size: 12px; background: var(--piedra-clara); color: var(--tinta); padding: 3px 8px; border-radius: 4px; }
.ad-preview .txt { padding: 10px 12px; font-size: 12.5px; }

@media (max-width: 1200px) {
  .record { grid-template-columns: 280px minmax(0, 1fr); }
  .record > .record-right { grid-column: 1 / -1; }
  .inbox { grid-template-columns: 280px minmax(0, 1fr); }
  .inbox-side { display: none; }
}
@media (max-width: 900px) {
  :root { --nav-w: 0px; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 150; }
  .app { grid-template-columns: 1fr; }
  .topbar, .main { grid-column: 1; }
  .page { padding: 16px; }
  .grid.c2, .grid.c3, .grid.c4, .grid.c6, .grid.side, .record, .form-grid { grid-template-columns: 1fr; }
  .grid.c4, .grid.c6 { grid-template-columns: 1fr 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .project-switch, .user-chip .role { display: none; }
  .menu-toggle { display: grid !important; }
}
.menu-toggle { display: none !important; }


/* ============================================================ Sophia · marca */
.btn { border-radius: 6px; font-family: var(--sans); }
.btn.primary { box-shadow: none; }
.card { box-shadow: none; }
.page-head h1 { font-size: 28px; }
.kpi .value { font-family: var(--serif); font-weight: 600; font-size: 28px; letter-spacing: -.01em; }
.nav-label, .section-title, .table th, .tabs .n { letter-spacing: .14em; }
.section-title { color: var(--cobre-oscuro); }
.input, select.input, textarea.input { background: var(--field); border-radius: 6px; }
.topbar { background: var(--surface); }
.topbar .search input { background: var(--field); }
.brand { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; height: auto; min-height: var(--top-h); padding: 14px 18px 12px; }
.logo { font-family: var(--serif); font-weight: 600; font-size: 25px; letter-spacing: -.02em; color: var(--piedra); line-height: 1; display: inline-flex; align-items: baseline; text-decoration: none !important; }
.logo i { display: inline-block; width: .24em; height: .24em; border-radius: 50%; background: var(--cobre); margin-left: .09em; }
.logo.dark { color: var(--tinta); }
.logo.xl { font-size: 64px; }
.acct-switch { display: flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; color: var(--nav-text); font-size: 12px; cursor: pointer; text-align: left; max-width: 190px; }
.acct-switch svg { width: 13px; height: 13px; flex: none; }
.acct-switch:hover { color: #fff; }
.sidebar-foot .tag { border: 1px solid #3A4560; border-radius: 4px; padding: 0 5px; font-size: 10.5px; color: var(--cobre-claro); }
.nav a.active { background: rgba(181,101,58,.16); }
.nav a.active svg { color: var(--cobre-claro); }
.nav a .count { background: var(--cobre); }
.icon-btn .dot { background: var(--cobre); }
.avatar { border-radius: 50%; }
.funnel-row .fill { background: var(--cobre); }
.step.done { background: #EBD3C4; color: var(--cobre-oscuro); }
.step.cur { background: var(--cobre); }
.u-disponible { background: var(--field); color: var(--tinta); border-color: var(--border-strong); }
.u-apartada { background: #F1E0D4; color: #8E4A26; }
.u-reservada { background: #E2B79E; color: #5E2B12; }
.u-vendida { background: #D7E1D4; color: #3F5A42; }
.u-entregada { background: #DDD7CC; color: #55565B; }
.badge .dotc { width: 6px; height: 6px; }
.toast { background: var(--tinta); border-radius: 6px; }
.toast.ok { background: #3F5A42; }
.col { background: #E3DCCF; border-radius: 6px; }
.deal-card, .assoc, .tl-body { background: var(--field); }
.msg { background: var(--field); }
.msg.out { background: #E3E9DE; border-color: #C9D6C5; }

/* ============================================================ Sophia · ingreso */
.login { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); min-height: 100vh; }
.login-art { background: var(--tinta); color: var(--piedra); padding: 56px 64px; display: flex; flex-direction: column; justify-content: center; position: relative; }
.login-line { font-family: var(--serif); font-style: italic; font-size: 24px; color: var(--cobre-claro); margin-top: 14px; }
.login-promise { list-style: none; padding: 0; margin: 40px 0 0; border-top: 1px solid #3A4560; }
.login-promise li { padding: 14px 0; border-bottom: 1px solid #3A4560; color: #D9D3C8; display: flex; gap: 12px; align-items: center; font-size: 15px; }
.login-promise li i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--cobre-claro); }
.login-promise li:first-child i { background: var(--cobre); border-color: var(--cobre); }
.login-foot { position: absolute; bottom: 32px; left: 64px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #8F8A80; }
.login-form { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 80px); background: var(--piedra); overflow-y: auto; }
.login-form form { max-width: 380px; width: 100%; }
.login-form h1 { font-size: 34px; }
.login-form .sub { color: var(--text-2); margin: 6px 0 22px; }
.login-form .err { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.demo-box { max-width: 520px; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border); }
.demo-group { margin-bottom: 12px; }
.demo-acc { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 6px; }
.demo-user { display: inline-flex; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 6px 10px 6px 6px; margin: 0 6px 6px 0; cursor: pointer; font-size: 12.5px; line-height: 1.25; }
.demo-user:hover { border-color: var(--cobre); }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login-art { padding: 36px 24px 56px; } .logo.xl { font-size: 46px; } .login-foot { left: 24px; bottom: 18px; } }

/* ============================================================ Sophia · elementos gráficos */
/* Titulares: Fraunces. Tarjetas, tablas y formularios: Inter. */
.card-head h2 { font-size: 17px; letter-spacing: -.01em; }
.card-head h3 { font-family: var(--serif); font-size: 16px; font-weight: 600; letter-spacing: -.005em; }
.modal-head h2 { font-size: 19px; }
.big-num, .serif-num { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }
.serif { font-family: var(--serif); }
.quote-serif { font-family: var(--serif); font-style: italic; font-weight: 400; }
.kpi.alert .value { color: var(--danger); }
.kpi .label { font-weight: 600; }
.empty .ico { border-radius: 22%; background: var(--surface-2); color: var(--text-2); }
.empty h3 { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.rule { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.rule.guide { border-top: 1px dashed var(--cobre); }   /* solo para medidas y guías */

/* El punto como marcador de estado.
   Reservado = cobre lleno · Vendido = salvia lleno · Disponible = hueco (contorno). */
.mk { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; vertical-align: middle; background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-2); }
.mk.lg { width: 10px; height: 10px; }
.mk-disponible { background: transparent; box-shadow: inset 0 0 0 1.5px var(--tinta); }
.mk-apartada { background: transparent; box-shadow: inset 0 0 0 2px var(--cobre); }
.mk-reservada, .mk-reservado, .mk-cobre { background: var(--cobre); box-shadow: none; }
.mk-vendida, .mk-vendido, .mk-ok, .mk-salvia { background: var(--salvia); box-shadow: none; }
.mk-entregada, .mk-tinta { background: var(--tinta); box-shadow: none; }
.mk-perdido, .mk-danger { background: var(--danger); box-shadow: none; }
.mk-neutral { background: var(--chart-3); box-shadow: none; }
.badge.st { background: transparent; border: 1px solid var(--border-strong); color: var(--text); gap: 6px; padding: 1px 8px 1px 7px; }
.badge.st .mk { width: 7px; height: 7px; }
.badge.st-reservada { border-color: var(--cobre-line); color: var(--cobre-oscuro); }
.badge.st-apartada { border-color: var(--cobre-line); color: var(--cobre-oscuro); }
.badge.st-vendida { border-color: var(--salvia-line); color: var(--ok); }
.legend .mk { margin-right: 5px; vertical-align: 0; }

/* Íconos con esquina suave (22%) */
.ico-box { width: 32px; height: 32px; border-radius: 22%; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; }
.ico-box svg { width: 16px; height: 16px; }
.ch-ico { border-radius: 22%; }
.tl-ico { border-radius: 22%; }

/* Sophia (asistente) */
.sophia-tag { display: inline-flex; align-items: baseline; gap: 0; font-family: var(--serif); font-weight: 600; letter-spacing: -.02em; color: var(--tinta); }
.sophia-tag i { display: inline-block; width: .24em; height: .24em; border-radius: 50%; background: var(--cobre); margin-left: .09em; }

/* Gráficos */
.spark i { background: var(--chart-4); }
.spark i:last-child { background: var(--chart-hi); }
.funnel-row .fill { background: var(--tinta); }
.funnel-row.hi .fill { background: var(--cobre); }

/* ============================================================ Sophia · superficies y unidades */
.btn, .btn-group button, .chip, .user-chip, .project-switch select, .quick-actions .qa span.c { background: var(--field); }
.btn.primary { background: var(--accent); } .btn.dark { background: var(--nav); } .btn.ghost { background: transparent; } .btn.ok { background: var(--ok); }
.btn.primary:hover { background: var(--accent-hover); } .btn.ghost:hover { background: var(--gray-soft); } .btn:not(.primary):not(.dark):not(.ok):not(.ghost):not(.danger):hover { background: var(--surface-2); }
.btn-group button.on, .chip.on { background: var(--nav); }
.modal, .drawer { background: var(--surface); border-radius: var(--radius); }
.modal-foot { border-radius: 0 0 var(--radius) var(--radius); }
.popover, .search-results { background: var(--field); border-radius: var(--radius); }
.composer, .reply, .inbox { background: var(--field); }
.unit { border-radius: var(--radius); }
.u-disponible { background: var(--field); color: var(--tinta); border-color: var(--border-strong); }
.u-apartada { background: var(--cobre-soft); color: var(--cobre-oscuro); }
.u-reservada { background: var(--cobre-line); color: #5E2B12; }
.u-vendida { background: var(--salvia-soft); color: var(--ok); }
.u-entregada { background: var(--tinta-soft); color: var(--text-2); }
.mk-soon { background: transparent; box-shadow: inset 0 0 0 2px var(--warn); }
