:root{
  --navy-950:#16233D; --navy-900:#0B2A63; --navy-700:#0038A8;
  --accent-500:#C8102E; --accent-400:#E23B4E;
  --bg:#F4F7FC; --white:#FFFFFF; --border:#E3E9F3; --text-dim:#5c6577;
}
*{box-sizing:border-box;}
body{
  margin:0; font-family:-apple-system,"Helvetica Neue",Arial,sans-serif;
  background:var(--bg); color:var(--navy-950);
}
header.admin-header{
  background:var(--navy-900); color:#fff; padding:16px 28px;
  display:flex; align-items:center; justify-content:space-between;
}
header.admin-header .brand{font-weight:800; font-size:18px;}
header.admin-header .brand span{color:var(--accent-400);}
.admin-header-right{display:flex; align-items:center; gap:14px;}

/* --- Campanita de notificaciones --- */
.notif-wrap{position:relative;}
.notif-btn{
  background:none; border:none; color:#fff; font-size:19px; cursor:pointer; position:relative;
  padding:6px; border-radius:8px; line-height:1; display:flex; align-items:center;
}
.notif-btn:hover{background:rgba(255,255,255,.12);}
.notif-badge{
  position:absolute; top:-2px; right:-2px; background:var(--accent-500); color:#fff;
  font-size:10px; font-weight:800; min-width:16px; height:16px; border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center; padding:0 3px; border:2px solid var(--navy-900);
}
.notif-dropdown{
  position:absolute; top:calc(100% + 10px); right:0; background:#fff; color:var(--navy-950);
  width:320px; max-height:380px; overflow-y:auto; border-radius:12px; box-shadow:0 14px 40px rgba(10,20,50,.25);
  z-index:50; border:1px solid var(--border);
}
.notif-dropdown-title{font-size:12px; font-weight:800; text-transform:uppercase; letter-spacing:.05em; color:var(--text-dim); padding:14px 16px 6px;}
.notif-list{padding:0 8px 8px;}
.notif-item{
  display:flex; align-items:center; gap:10px; padding:10px 8px; border-radius:8px; text-decoration:none;
  color:var(--navy-950); font-size:13.5px;
}
.notif-item:hover{background:var(--bg);}
.notif-count{
  background:var(--accent-500); color:#fff; font-size:11px; font-weight:800; min-width:22px; height:22px;
  border-radius:999px; display:inline-flex; align-items:center; justify-content:center; flex-shrink:0;
}
.notif-empty{padding:16px; color:var(--text-dim); font-size:13px; text-align:center;}
nav.admin-nav{
  background:var(--white); border-bottom:1px solid var(--border);
  padding:0 28px; display:flex; gap:22px;
}
nav.admin-nav a{
  color:var(--text-dim); text-decoration:none; font-size:14px; font-weight:600;
  padding:14px 0; display:inline-block; border-bottom:2px solid transparent;
}
nav.admin-nav a.active, nav.admin-nav a:hover{color:var(--navy-700); border-color:var(--accent-500);}
main{max-width:1100px; margin:0 auto; padding:32px 28px;}
h1{font-size:22px; margin:0 0 20px;}
.cards{display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px; margin-bottom:28px;}
.card{background:var(--white); border:1px solid var(--border); border-radius:12px; padding:20px;}
.card .num{font-size:30px; font-weight:800; color:var(--accent-500);}
.card .lbl{font-size:13px; color:var(--text-dim); margin-top:4px;}
.cards-secondary{margin-bottom:8px;}
.card-accent{background:linear-gradient(135deg,var(--navy-900),var(--navy-700)); border:none;}
.card-accent .num{color:#fff;}
.card-accent .lbl{color:rgba(255,255,255,.75);}

/* --- Buscador/filtros de tablas --- */
.toolbar{display:flex; flex-wrap:wrap; gap:10px; margin-bottom:16px; align-items:center;}
.toolbar-search{
  flex:1; min-width:220px; padding:10px 14px; border-radius:8px; border:1px solid var(--border);
  font-size:13.5px; font-family:inherit;
}
.toolbar-select{
  padding:10px 12px; border-radius:8px; border:1px solid var(--border); font-size:13.5px; font-family:inherit;
  background:#fff; color:var(--navy-950);
}
.btn-ghost{background:#fff; color:var(--navy-700); border:1px solid var(--border);}

/* --- Barra de acciones en lote --- */
.bulk-bar{
  display:flex; align-items:center; gap:12px; background:#EAF1FB; border:1px solid #C9DBF5;
  border-radius:10px; padding:10px 16px; margin-bottom:14px; font-size:13.5px; color:var(--navy-700); font-weight:600;
}
.fila-check, #checkTodos{width:16px; height:16px; cursor:pointer;}

/* --- Reportes / graficos del dashboard --- */
.report-grid{display:grid; grid-template-columns:1.3fr 1fr; gap:20px; align-items:start;}
@media (max-width:860px){ .report-grid{grid-template-columns:1fr;} }
.chart-box{position:relative; height:280px;}
table{width:100%; border-collapse:collapse; background:var(--white); border-radius:12px; overflow:hidden; box-shadow:0 1px 3px rgba(20,30,60,.06);}
th, td{text-align:left; padding:12px 14px; font-size:13.5px; border-bottom:1px solid var(--border);}
th{background:#F0F3FA; color:var(--text-dim); font-weight:700; text-transform:uppercase; font-size:11px; letter-spacing:.04em;}
tr:last-child td{border-bottom:none;}
tbody tr{transition:background .12s ease;}
tbody tr:nth-child(even){background:#FAFBFE;}
tbody tr:hover{background:#EFF4FC;}

/* --- Miniatura de foto en tablas de inventario --- */
.prop-thumb{width:56px; height:56px; border-radius:10px; object-fit:cover; border:1px solid var(--border); display:block; background:#EAF0FA;}
.prop-thumb-empty{
  width:56px; height:56px; border-radius:10px; border:1px dashed #C9D4E8; background:#F5F8FC;
  display:flex; align-items:center; justify-content:center; font-size:20px; color:#B9C4DA;
}
.prop-title{font-weight:700; color:var(--navy-950);}
.prop-loc{color:var(--text-dim); font-size:12px; margin-top:2px;}

/* --- Foto de perfil (asesores) --- */
.avatar{width:44px; height:44px; border-radius:50%; object-fit:cover; border:1px solid var(--border); display:block; background:#EAF0FA;}
.avatar-empty{
  width:44px; height:44px; border-radius:50%; border:1px solid var(--border); background:#EEF2F8;
  display:flex; align-items:center; justify-content:center; font-size:15px; font-weight:800; color:#8593AC;
}

/* --- Insignia de origen (admin / asesor / cliente) --- */
.origen-pill{display:inline-block; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:700; text-transform:capitalize;}
.origen-pill.admin{background:#E4E7EC; color:#475467;}
.origen-pill.asesor{background:#DCE6FB; color:var(--navy-700);}
.origen-pill.cliente{background:#F0E4FB; color:#6B2FB3;}

/* --- Insignia de operación (venta / alquiler) --- */
.operacion-pill{display:inline-block; padding:3px 10px; border-radius:999px; font-size:11px; font-weight:700; text-transform:capitalize;}
.operacion-pill.venta{background:#DCF3E4; color:#0F7A3D;}
.operacion-pill.alquiler{background:#DCE6FB; color:var(--navy-700);}
.badge{display:inline-block; padding:3px 10px; border-radius:999px; font-size:11.5px; font-weight:700;}
.badge.pendiente{background:#FFF3D6; color:#8A6100;}
.badge.aprobado, .badge.pagado, .badge.confirmada{background:#DCF3E4; color:#0F7A3D;}
.badge.rechazado, .badge.cancelado, .badge.cancelada, .badge.vencido{background:#FBE1E4; color:var(--accent-500);}
.badge.bloqueo{background:#E4E7EC; color:#475467;}
.badge.disponible{background:#DCF3E4; color:#0F7A3D;}
.badge.vendida{background:#DCE6FB; color:var(--navy-700);}
.badge.alquilada{background:#F0E4FB; color:#6B2FB3;}
.btn{
  display:inline-block; padding:7px 14px; border-radius:8px; font-size:12.5px; font-weight:700;
  border:none; cursor:pointer; text-decoration:none; margin-right:6px;
}
.btn-approve{background:#0F7A3D; color:#fff;}
.btn-reject{background:var(--accent-500); color:#fff;}
.btn-neutral{background:var(--navy-700); color:#fff;}
.login-wrap{
  min-height:100vh; display:flex; align-items:center; justify-content:center; background:var(--navy-900);
}
.login-box{background:#fff; border-radius:16px; padding:40px; width:100%; max-width:360px; box-shadow:0 20px 50px rgba(0,0,0,.3);}
.login-box h1{font-size:20px; margin-bottom:4px;}
.login-box p.sub{color:var(--text-dim); font-size:13px; margin-bottom:22px;}
.login-box input{width:100%; padding:11px 12px; border-radius:8px; border:1px solid var(--border); margin-bottom:14px; font-size:14px;}
.login-box button{
  width:100%; padding:12px 0; border-radius:8px; border:none; background:var(--accent-500);
  color:#fff; font-weight:700; cursor:pointer; font-size:14px;
}
.error-msg{background:#FBE1E4; color:var(--accent-500); padding:10px 14px; border-radius:8px; font-size:13px; margin-bottom:14px;}
.empty{color:var(--text-dim); font-size:14px; padding:30px; text-align:center;}

/* --- Formularios y tarjetas de contenido (panel asesor, edición de propiedades, contratos, inventario) --- */
.success-msg{background:#DCF3E4; color:#0F7A3D; padding:12px 16px; border-radius:8px; font-size:13.5px; margin-bottom:18px;}
.success-msg b{font-weight:800;}
.form-card{background:var(--white); border:1px solid var(--border); border-radius:12px; padding:24px; margin-bottom:24px;}
.form-card h2{font-size:16px; margin:0 0 16px;}
.form-row{display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px;}
.form-row.single{grid-template-columns:1fr;}
.form-group{display:flex; flex-direction:column; gap:6px; margin-bottom:14px;}
.form-group label{font-size:12.5px; font-weight:700; color:var(--text-dim);}
.form-group input[type=text], .form-group input[type=number], .form-group input[type=email],
.form-group input[type=tel], .form-group input[type=date], .form-group input[type=file],
.form-group select, .form-group textarea{
  padding:10px 12px; border-radius:8px; border:1px solid var(--border); font-size:14px; font-family:inherit; width:100%;
}
.form-group textarea{min-height:120px; resize:vertical;}
.form-checkbox{display:flex; align-items:center; gap:8px; font-size:13.5px; margin-bottom:14px;}
.form-actions{margin-top:18px;}
.btn-primary{background:var(--accent-500); color:#fff; border:none; padding:11px 22px; border-radius:8px; font-weight:700; font-size:14px; cursor:pointer;}
.btn-link{color:var(--navy-700); text-decoration:none; font-size:13px; font-weight:600; margin-left:14px;}
.fotos-preview{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px;}
.fotos-preview img{width:80px; height:80px; object-fit:cover; border-radius:8px; border:1px solid var(--border);}
.totals-bar{display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:14px; margin-bottom:22px;}
.totals-bar .card .num{font-size:22px;}
.contratos-editor{margin-bottom:30px;}
.actions-inline{display:flex; flex-wrap:wrap; gap:6px;}

/* --- Hero de bienvenida del panel de asesor --- */
.asesor-hero{
  background:linear-gradient(135deg,var(--navy-950),var(--navy-700));
  border-radius:16px; padding:32px; color:#fff;
  display:flex; align-items:center; justify-content:space-between; gap:24px; flex-wrap:wrap;
  position:relative; overflow:hidden;
}
.asesor-hero::after{
  content:''; position:absolute; top:-50px; right:-50px; width:220px; height:220px;
  background:radial-gradient(circle,rgba(200,16,46,.35),transparent 70%); border-radius:50%;
}
.asesor-hero-text{position:relative; z-index:1; max-width:560px;}
.asesor-hero-greeting{font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:rgba(255,255,255,.65); margin:0 0 6px;}
.asesor-hero-text h1{margin:0 0 8px; font-size:24px; color:#fff;}
.asesor-hero-sub{margin:0; font-size:14px; color:rgba(255,255,255,.82); line-height:1.55;}
.asesor-hero-cta{
  position:relative; z-index:1; background:var(--accent-500); color:#fff; padding:13px 24px; border-radius:10px;
  font-weight:700; font-size:14px; text-decoration:none; white-space:nowrap;
  transition:transform .15s ease, box-shadow .15s ease; box-shadow:0 10px 24px -8px rgba(200,16,46,.6);
}
.asesor-hero-cta:hover{transform:translateY(-2px);}

/* --- Ficha de propiedad (vista de detalle + galería) --- */
.ficha-grid{display:grid; grid-template-columns:1.3fr 1fr; gap:24px; align-items:start;}
@media (max-width:900px){ .ficha-grid{grid-template-columns:1fr;} }
.ficha-badges{display:flex; gap:8px; flex-wrap:wrap;}
.ficha-loc{color:var(--text-dim); font-size:14px; margin:8px 0;}
.ficha-price{display:flex; gap:16px; align-items:baseline; flex-wrap:wrap; font-size:26px; font-weight:800; color:var(--accent-500); margin-top:8px;}
.ficha-price-usd{font-size:16px; font-weight:700; color:var(--text-dim);}
.detail-grid{display:grid; grid-template-columns:1fr 1fr; gap:16px;}
.detail-item{display:flex; flex-direction:column; gap:3px;}
.detail-lbl{font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-dim); font-weight:700;}
.detail-val{font-size:14px; color:var(--navy-950);}
.ficha-gallery{background:var(--white); border:1px solid var(--border); border-radius:12px; padding:16px; position:sticky; top:20px;}
.ficha-main-photo{width:100%; height:340px; object-fit:cover; border-radius:10px; display:block; background:#EAF0FA;}
.ficha-main-empty{
  width:100%; height:340px; border-radius:10px; border:1px dashed #C9D4E8; background:#F5F8FC;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; font-size:40px; color:#B9C4DA;
}
.ficha-main-empty span{font-size:13px; color:var(--text-dim);}
.ficha-thumbs{display:flex; gap:8px; flex-wrap:wrap; margin-top:10px;}
.ficha-thumb{width:64px; height:64px; object-fit:cover; border-radius:8px; cursor:pointer; border:2px solid transparent; opacity:.7;}
.ficha-thumb:hover{opacity:1;}
.ficha-thumb.active{border-color:var(--accent-500); opacity:1;}
.ficha-upload{margin-top:16px; padding-top:16px; border-top:1px solid var(--border); display:flex; flex-direction:column; gap:8px;}
.ficha-upload label{font-size:12.5px; font-weight:700; color:var(--text-dim);}
.ficha-upload input[type=file]{font-size:13px;}

/* --- Ficha de asesor --- */
.agent-photo-big{width:160px; height:160px; border-radius:50%; object-fit:cover; border:3px solid var(--border); background:#EAF0FA;}
.agent-photo-big-empty{
  width:160px; height:160px; border-radius:50%; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(135deg,var(--navy-900),var(--navy-700)); color:#fff; font-size:56px; font-weight:800;
}
.agent-prop-list{display:flex; flex-direction:column; gap:10px;}
.agent-prop-item{display:flex; align-items:center; gap:12px; padding:10px; border:1px solid var(--border); border-radius:10px; text-decoration:none; color:inherit; transition:background .12s ease;}
.agent-prop-item:hover{background:var(--bg);}
.agent-prop-item-body{flex:1; min-width:0;}

/* --- Panel de asesor: layout con barra lateral de herramientas --- */
.dash-grid{display:grid; grid-template-columns:2fr 1fr; gap:24px; align-items:start; margin-top:28px;}
@media (max-width:900px){ .dash-grid{grid-template-columns:1fr;} }
.dash-side{display:flex; flex-direction:column; gap:20px;}
.dash-side .form-card{margin-bottom:0;}

/* --- Avisos / recordatorios inteligentes --- */
.aviso-list{display:flex; flex-direction:column; gap:10px;}
.aviso-item{display:flex; align-items:flex-start; gap:10px; padding:10px 12px; border-radius:10px; font-size:13px; line-height:1.5;}
.aviso-item.warn{background:#FFF8EC; border:1px solid #F3DCA3; color:#7A5A0E;}
.aviso-item.ok{background:#F0FBF4; border:1px solid #BFE8CE; color:#1F7A44;}
.aviso-icon{font-size:16px; line-height:1.4; flex-shrink:0;}
.aviso-item a{color:inherit; font-weight:700; text-decoration:underline;}

/* --- Actividad reciente --- */
.activity-list{display:flex; flex-direction:column; gap:14px;}
.activity-item{display:flex; gap:10px; align-items:flex-start;}
.activity-dot{width:8px; height:8px; border-radius:50%; background:var(--accent-500); margin-top:6px; flex-shrink:0;}
.activity-text{font-size:13px; color:var(--navy-950); line-height:1.4;}
.activity-text b{font-weight:700;}
.activity-time{font-size:11.5px; color:var(--text-dim); margin-top:2px;}

/* --- Compartir por WhatsApp --- */
.btn-whatsapp{background:#25D366; color:#fff;}

/* --- Badge estado "realizada" (visitas) --- */
.badge.realizada{background:#DCE6FB; color:var(--navy-700);}

/* --- Agenda / calendario de visitas (panel de asesor) --- */
.agenda-nav{display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; flex-wrap:wrap; gap:10px;}
.agenda-nav h2{margin:0; font-size:17px;}
.agenda-nav-btns{display:flex; gap:8px; flex-wrap:wrap;}
.agenda-nav-btns a{background:#fff; border:1px solid var(--border); color:var(--navy-700); padding:7px 14px; border-radius:8px; font-size:13px; font-weight:700; text-decoration:none;}
.agenda-nav-btns a:hover{background:var(--bg);}
.agenda-grid{display:grid; grid-template-columns:repeat(7,1fr); gap:6px; margin-bottom:32px;}
.agenda-dow{text-align:center; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--text-dim); padding-bottom:4px;}
.agenda-day{min-height:96px; border:1px solid var(--border); border-radius:10px; background:var(--white); padding:6px; display:flex; flex-direction:column; gap:3px; overflow:hidden;}
.agenda-day.empty{background:transparent; border-color:transparent;}
.agenda-day.hoy{border-color:var(--accent-500); box-shadow:inset 0 0 0 1px var(--accent-500);}
.agenda-day-num{font-size:12px; font-weight:700; color:var(--text-dim);}
.agenda-day.hoy .agenda-day-num{color:var(--accent-500);}
.agenda-chip{font-size:10.5px; padding:2px 6px; border-radius:6px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:default;}
.agenda-chip.pendiente{background:#FFF3D6; color:#8A6100;}
.agenda-chip.confirmada{background:#DCF3E4; color:#0F7A3D;}
.agenda-chip.realizada{background:#DCE6FB; color:var(--navy-700);}
.agenda-chip.cancelada{background:#FBE1E4; color:var(--accent-500); text-decoration:line-through;}
@media (max-width:700px){
  .agenda-grid{gap:3px;}
  .agenda-day{min-height:56px; padding:3px;}
  .agenda-chip{font-size:9px; padding:1px 3px;}
}
