/* ─────────────────────────────────────────────────────────────────────────
   CRM Propiedades — shared stylesheet
   ───────────────────────────────────────────────────────────────────────── */

*  { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 13px; background: #111; color: #111; }
body.map-body, body.pipeline-body { overflow: hidden; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-body { display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,#1e3a5f,#0f172a); }
.login-card { background:#fff; border-radius:14px; padding:32px 28px; width:340px; box-shadow:0 12px 48px rgba(0,0,0,.4); }
.login-card h1 { font-size:20px; margin-bottom:6px; }
.login-card p { font-size:12px; color:#6b7280; margin-bottom:18px; }
.login-card input { width:100%; padding:11px 12px; border:1px solid #d1d5db; border-radius:8px; font-size:14px; margin-bottom:10px; }
.login-card button { width:100%; padding:11px; border:none; border-radius:8px; background:#2563eb; color:#fff; font-weight:700; font-size:14px; cursor:pointer; }
.login-card button:hover { background:#1d4ed8; }
.login-msg { font-size:12px; margin-top:10px; min-height:16px; color:#6b7280; }
.login-msg.err { color:#dc2626; }
.login-msg.ok  { color:#16a34a; }

/* ── App shell common to map.html / pipeline.html ───────────────────────── */
#app { display:flex; height:100vh; }
#sidebar { width:320px; flex-shrink:0; height:100vh; overflow-y:auto; background:#fff; border-right:1px solid #e5e7eb; z-index:10; }
#main { flex:1; min-width:0; height:100vh; display:flex; flex-direction:column; position:relative; }
#right-panel { width:380px; flex-shrink:0; background:#fff; border-left:1px solid #e5e7eb; height:100vh; overflow-y:auto; display:none; }
#right-panel.open { display:block; }

.s-head { background:#1e3a5f; color:#fff; padding:12px 14px; }
.s-head .nav-tabs { display:flex; gap:8px; margin-top:8px; font-size:11px; }
.s-head .nav-tabs a { color:#cbd5e1; text-decoration:none; padding:4px 8px; border-radius:6px; }
.s-head .nav-tabs a.active { background:rgba(255,255,255,.18); color:#fff; }
.s-head h1 { font-size:15px; font-weight:700; margin-bottom:2px; }
.s-head p { font-size:10px; opacity:.7; }

.s-sec { padding:10px 14px; border-bottom:1px solid #e5e7eb; }
.s-sec h2 { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:#6b7280; margin-bottom:8px; display:flex; align-items:center; gap:6px; }

/* Collapsible <details> sections — same look as .s-sec h2 */
.s-sec-collapsible { padding:10px 14px; border-bottom:1px solid #e5e7eb; }
.s-sec-collapsible > summary { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:#6b7280; display:flex; align-items:center; gap:6px; cursor:pointer; list-style:none; user-select:none; }
.s-sec-collapsible > summary::-webkit-details-marker { display:none; }
.s-sec-collapsible > summary::before { content:'▸'; font-size:9px; color:#9ca3af; transition:transform .15s; }
.s-sec-collapsible[open] > summary::before { transform:rotate(90deg); }

/* Listings mode tabs (URL / GeoJSON / .py) */
.lst-tabs { display:flex; gap:2px; margin-bottom:6px; padding:2px; background:#f3f4f6; border-radius:7px; }
.lst-tab { flex:1; padding:5px 8px; font-size:11px; font-weight:600; cursor:pointer; border:none; border-radius:5px; background:transparent; color:#6b7280; }
.lst-tab.active { background:#fff; color:#16a34a; box-shadow:0 1px 2px rgba(0,0,0,.05); }
.lst-tab:hover:not(.active) { color:#374151; }

code { font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:90%; background:#f3f4f6; padding:1px 4px; border-radius:3px; }

#add-lbl { display:flex; align-items:center; justify-content:center; gap:8px; width:100%; padding:11px; background:#2563eb; color:#fff; border-radius:8px; cursor:pointer; font-size:13px; font-weight:700; }
#add-lbl:hover { background:#1d4ed8; }
#file-inp { display:none; }

#layer-list { margin-top:8px; display:flex; flex-direction:column; gap:4px; }
.li { display:flex; align-items:center; gap:7px; padding:7px 9px; border-radius:7px; border:1.5px solid #e5e7eb; background:#fafafa; }
.li.act { background:#eff6ff; border-color:#2563eb; }
.li-sw { width:13px; height:13px; border-radius:3px; flex-shrink:0; }
.li-nm { flex:1; font-size:12px; font-weight:600; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.li-ct { font-size:10px; color:#9ca3af; font-family:monospace; flex-shrink:0; }
.li-eye { background:none; border:none; cursor:pointer; font-size:14px; flex-shrink:0; padding:0 2px; line-height:1; }
.li-del { background:none; border:none; cursor:pointer; color:#dc2626; font-size:16px; flex-shrink:0; padding:0 3px; line-height:1; }
.li-save { background:none; border:none; cursor:pointer; color:#16a34a; font-size:13px; flex-shrink:0; padding:0 3px; line-height:1; }

.diag { font-size:10px; padding:5px 7px; border-radius:6px; line-height:1.6; white-space:pre-wrap; margin-top:5px; }
.dok   { background:#dcfce7; color:#166534; }
.dwarn { background:#fef9c3; color:#854d0e; }
.derr  { background:#fee2e2; color:#991b1b; }

#fmap-sec { display:none; }
.fr { display:flex; align-items:center; gap:6px; margin-bottom:5px; }
.fr label { font-size:10px; color:#6b7280; min-width:78px; }
.fr select, .fr input { flex:1; font-size:11px; padding:3px 5px; border:1px solid #d1d5db; border-radius:5px; }

#stats { display:flex; background:#f9fafb; border-bottom:1px solid #e5e7eb; flex-shrink:0; }
.sc { flex:1; text-align:center; padding:7px 2px; border-right:1px solid #e5e7eb; }
.sc:last-child { border-right:none; }
.sv { font-size:14px; font-weight:700; font-family:monospace; }
.sl { font-size:9px; color:#6b7280; text-transform:uppercase; }

.badge { font-size:9px; font-weight:700; padding:2px 6px; border-radius:8px; margin-right:4px; }
.ba { background:#dbeafe; color:#1e40af; }
.bb { background:#dcfce7; color:#166534; }
.bc { background:#fef9c3; color:#854d0e; }
.bd { background:#ede9fe; color:#5b21b6; }
.be { background:#d1fae5; color:#065f46; }
.bf { background:#fce7f3; color:#9d174d; }
.bg { background:#e0e7ff; color:#3730a3; }

.cl { font-size:10px; color:#6b7280; margin:3px 0 2px; }
input[type=range] { width:100%; accent-color:#2563eb; }
.rr { display:flex; justify-content:space-between; font-size:10px; font-family:monospace; color:#6b7280; margin-top:1px; }

.tg { display:grid; grid-template-columns:1fr 1fr; gap:3px; margin-top:4px; }
.tb { padding:4px 5px; font-size:10px; border:1px solid #d1d5db; border-radius:5px; background:#fff; color:#6b7280; cursor:pointer; text-align:center; }
.tb.on { background:#dbeafe; color:#1e40af; border-color:#93c5fd; }

.r2-actions { display:flex; gap:4px; margin-top:4px; }
.r2-actions button { flex:1; font-size:10px; padding:3px 6px; cursor:pointer; border:1px solid #d1d5db; border-radius:5px; background:#fff; color:#374151; }

.gbtn { font-size:11px; padding:5px 8px; width:100%; cursor:pointer; border:1px solid #d1d5db; border-radius:6px; background:#fff; color:#374151; }
.gbtn.pick { background:#fef9c3; color:#92400e; border-color:#fbbf24; }
.gbtn.on   { background:#dbeafe; color:#1e40af; border-color:#93c5fd; }
.cb { font-size:10px; padding:3px 8px; width:100%; margin-top:4px; cursor:pointer; border:1px solid #d1d5db; border-radius:5px; background:#fff; color:#374151; }

.ri { padding:5px 14px; border-bottom:1px solid #f3f4f6; cursor:pointer; font-size:11px; }
.ri:hover { background:#f9fafb; }
.ri-top { display:flex; align-items:center; gap:5px; font-weight:600; color:#111; }
.ri-sub { color:#6b7280; font-size:10px; margin-top:1px; }

#pgrid { display:flex; flex-wrap:wrap; gap:3px; margin-top:5px; }
.ph { position:relative; width:44px; height:44px; border-radius:5px; overflow:hidden; border:2px solid #e5e7eb; flex-shrink:0; }
.ph img { width:100%; height:100%; object-fit:cover; }
.ph-st { position:absolute; bottom:1px; right:1px; width:12px; height:12px; border-radius:50%; font-size:7px; display:flex; align-items:center; justify-content:center; color:#fff; font-weight:700; }

.mtag { display:inline-flex; align-items:center; gap:3px; padding:3px 7px; border-radius:10px; font-size:10px; font-weight:600; cursor:pointer; border:1.5px solid #d1d5db; background:#f9fafb; margin:2px 2px 0 0; }
.mtag.on { border-color:#2563eb; background:#dbeafe; color:#1e40af; }

#lsw { position:absolute; top:10px; right:10px; z-index:1000; display:flex; gap:3px; }
.lbtn { font-size:11px; font-weight:600; padding:5px 10px; border:1px solid rgba(0,0,0,.2); border-radius:6px; background:rgba(255,255,255,.93); cursor:pointer; box-shadow:0 1px 4px rgba(0,0,0,.18); }
.lbtn.on { background:#2563eb; color:#fff; border-color:#2563eb; }

.lst-card { padding:8px 10px; border:1px solid #e5e7eb; border-radius:7px; background:#fafafa; cursor:pointer; transition:border-color .15s; margin-bottom:4px; }
.lst-card:hover { border-color:#16a34a; background:#f0fdf4; }
.lst-price { font-size:13px; font-weight:700; color:#16a34a; }
.lst-title { font-size:11px; color:#374151; margin-top:1px; }
.lst-meta  { font-size:10px; color:#9ca3af; margin-top:1px; }

#cm-modal { display:none; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:9999; align-items:center; justify-content:center; }
.cm-card { background:#fff; border-radius:12px; padding:20px; width:380px; max-width:92vw; max-height:80vh; overflow-y:auto; box-shadow:0 8px 32px rgba(0,0,0,.2); }
.cm-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.cm-close { background:none; border:none; font-size:22px; cursor:pointer; color:#6b7280; line-height:1; }
.cm-list { margin-bottom:12px; font-size:12px; }
.cm-item { padding:8px 10px; background:#f9fafb; border-radius:6px; margin-bottom:6px; }
.cm-item .meta { font-size:10px; color:#6b7280; margin-bottom:3px; }
.cm-item .body { font-size:12px; color:#111; line-height:1.4; }
.cm-input textarea { width:100%; font-size:12px; padding:5px 8px; border:1px solid #d1d5db; border-radius:6px; resize:vertical; }
.cm-input input { width:100%; font-size:12px; padding:5px 8px; border:1px solid #d1d5db; border-radius:6px; margin-bottom:6px; }
.cm-input button { width:100%; margin-top:6px; padding:7px; font-size:12px; font-weight:700; cursor:pointer; border:none; border-radius:6px; background:#2563eb; color:#fff; }

/* ── Right panel (property detail) ──────────────────────────────────────── */
#right-panel header { padding:14px 16px; border-bottom:1px solid #e5e7eb; display:flex; align-items:center; justify-content:space-between; background:#f9fafb; position:sticky; top:0; z-index:1; }
#right-panel header h2 { font-size:14px; font-weight:700; }
#right-panel .panel-section { padding:14px 16px; border-bottom:1px solid #f3f4f6; }
#right-panel .panel-section h3 { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:#6b7280; margin-bottom:8px; }
#right-panel .field { display:flex; align-items:center; gap:6px; margin-bottom:6px; }
#right-panel .field label { font-size:11px; color:#6b7280; flex:0 0 130px; }
#right-panel .field input,
#right-panel .field select,
#right-panel .field textarea { flex:1; font-size:12px; padding:5px 7px; border:1px solid #d1d5db; border-radius:5px; }
#right-panel .field textarea { min-height:60px; resize:vertical; }
#right-panel .panel-action { width:100%; padding:8px; font-size:12px; font-weight:700; background:#2563eb; color:#fff; border:none; border-radius:6px; cursor:pointer; margin-top:8px; }
#right-panel .panel-action.danger { background:#dc2626; }
#right-panel .panel-action.secondary { background:#f3f4f6; color:#111; }
.score-pill { display:inline-block; padding:3px 9px; border-radius:99px; font-size:11px; font-weight:700; background:#eef2ff; color:#3730a3; }
.score-pill.high { background:#dcfce7; color:#14532d; }
.score-pill.low  { background:#fee2e2; color:#7f1d1d; }
.tags-row { display:flex; flex-wrap:wrap; gap:4px; margin-top:4px; }
.tag-chip { font-size:10px; padding:2px 7px; background:#e0e7ff; color:#3730a3; border-radius:99px; }

/* ── Pipeline table ─────────────────────────────────────────────────────── */
.pipeline-body #main { background:#fff; }
#pipeline-table-wrap { flex:1; overflow:auto; background:#fff; }
#pipeline-table { width:100%; border-collapse:collapse; font-size:12px; background:#fff; color:#111; }
#pipeline-table thead th { position:sticky; top:0; background:#f9fafb; padding:8px 10px; text-align:left; font-size:10px; text-transform:uppercase; color:#6b7280; border-bottom:1px solid #e5e7eb; cursor:pointer; user-select:none; white-space:nowrap; }
#pipeline-table thead th.sorted-asc::after  { content:' ▲'; font-size:9px; color:#2563eb; }
#pipeline-table thead th.sorted-desc::after { content:' ▼'; font-size:9px; color:#2563eb; }
#pipeline-table tbody tr { border-bottom:1px solid #f3f4f6; cursor:pointer; background:#fff; color:#111; }
#pipeline-table tbody tr:hover { background:#f9fafb; }
#pipeline-table tbody tr.selected { background:#eff6ff; }
#pipeline-table tbody td { padding:7px 10px; vertical-align:top; color:#111; }
#pipeline-table tbody td.num { font-family:monospace; text-align:right; }
.pipeline-toolbar { display:flex; align-items:center; gap:8px; padding:10px 14px; background:#fff; border-bottom:1px solid #e5e7eb; flex-shrink:0; flex-wrap:wrap; }
.pipeline-toolbar input, .pipeline-toolbar select { font-size:12px; padding:6px 8px; border:1px solid #d1d5db; border-radius:6px; }
.pipeline-toolbar input[type=search] { min-width:220px; }
.pipeline-toolbar button { font-size:12px; padding:6px 10px; cursor:pointer; border:1px solid #d1d5db; border-radius:6px; background:#fff; }
.pipeline-toolbar button.primary { background:#2563eb; color:#fff; border-color:#2563eb; font-weight:700; }
.pipeline-empty { padding:40px; text-align:center; color:#6b7280; font-size:13px; }

.status-pill { display:inline-block; padding:2px 8px; border-radius:99px; font-size:10px; font-weight:600; }
.status-lead         { background:#e5e7eb; color:#374151; }
.status-contacted    { background:#fef3c7; color:#92400e; }
.status-visited      { background:#fef9c3; color:#854d0e; }
.status-negotiating  { background:#fed7aa; color:#9a3412; }
.status-due_diligence{ background:#dbeafe; color:#1e40af; }
.status-offer_sent   { background:#ede9fe; color:#5b21b6; }
.status-won          { background:#dcfce7; color:#14532d; }
.status-lost         { background:#fee2e2; color:#7f1d1d; }
.status-archived     { background:#f3f4f6; color:#6b7280; }
